Hi, I've got a segfault in __strlen_avx2 () at
../sysdeps/x86_64/multiarch/strlen-avx2.S:65
While defining a variable that has been undefined in a foreach loop using Make
4.2.1 on my Bullseye/sid workstation.
The code is a bit tricky. I've attached the Makefile and the backtrace.
# Bug in GNU Make 4.2.1
#
# defining a variable that has been undefined in a foreach loop produce a
# segfault on X64 machine.
#
# Disabling export avoid the sefault
export
# As same as disabling this define
DISCARD_ENV := templates from script format
define discard_env
$(foreach var,$(DISCARD_ENV),$(eval undefine $(var)))
endef
ARTIFACTS := build/a build/b
# In this situation: defining a variable that has been undefined
# in the foreach loop befaure causes the segfault:
templates := t1.tpl t2.tpl # <----
format := qcow2
.PHONY: all
all: $(ARTIFACTS)
$(ARTIFACTS):
@echo $@
Starting program: /usr/bin/make
Program received signal SIGSEGV, Segmentation fault.
[33m__strlen_avx2[m () at [32m../sysdeps/x86_64/multiarch/strlen-avx2.S[m:65
65 ../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or directory.
#0 [33m__strlen_avx2[m () at
[32m../sysdeps/x86_64/multiarch/strlen-avx2.S[m:65
#1 [34m0x000055555556392f[m in [33mallocated_variable_append[m
([36mv[m=0x5555555b75f0) at [32m../../expand.c[m:540
#2 [33mrecursively_expand_for_file[m ([36mv=v@entry[m=0x5555555b75f0,
[36mfile=file@entry[m=0x5555555b7880)[m
[m at [32m../../expand.c[m:138
#3 [34m0x000055555557d88d[m in [33mtarget_environment[m
([36mfile[m=<optimized out>) at [32m../../variable.c[m:1090
#4 [34m0x000055555556ceb1[m in [33mstart_job_command[m
([36mchild=child@entry[m=0x5555555bb780) at [32m../../job.c[m:1364
#5 [34m0x000055555556d812[m in [33mstart_waiting_job[m
([36mc=c@entry[m=0x5555555bb780) at [32m../../job.c[m:1605
#6 [34m0x000055555556de28[m in [33mnew_job[m ([36mfile[m=0x5555555b7880)
at [32m../../job.c[m:1878
#7 [34m0x0000555555579d47[m in [33mremake_file[m
([36mfile[m=0x5555555b7880) at [32m../../remake.c[m:1234
#8 [33mupdate_file_1[m ([36mdepth[m=<optimized out>,
[36mfile[m=0x5555555b7880) at [32m../../remake.c[m:835
#9 [33mupdate_file[m ([36mfile[m=<optimized out>, [36mdepth[m=<optimized
out>) at [32m../../remake.c[m:336
#10 [34m0x000055555557a265[m in [33mcheck_dep[m
([36mfile[m=0x5555555b7880, [36mdepth[m=2, [36mdepth@entry[m=1, [m
[m[36mthis_mtime=this_mtime@entry[m=1,
[36mmust_make_ptr=must_make_ptr@entry[m=0x7fffffffbffc) at
[32m../../remake.c[m:1024
#11 [34m0x0000555555578fce[m in [33mupdate_file_1[m
([36mdepth[m=<optimized out>, [36mfile[m=0x5555555b76c0) at
[32m../../remake.c[m:572
#12 [33mupdate_file[m ([36mfile=file@entry[m=0x5555555b76c0,
[36mdepth[m=<optimized out>) at [32m../../remake.c[m:336
#13 [34m0x000055555557a6df[m in [33mupdate_goal_chain[m
([36mgoaldeps[m=<optimized out>) at [32m../../remake.c[m:151
#14 [34m0x000055555555ef3f[m in [33mmain[m ([36margc[m=<optimized out>,
[36margv[m=<optimized out>, [36menvp[m=<optimized out>)[m
[m at [32m../../main.c[m:2599
quit
# Bug in GNU Make 4.2.1
#
# defining a variable that has been undefined in a foreach loop produce a
# segfault on X64 machine.
#
# Disabling export avoid the sefault
export
# As same as disabling this part define
DISCARD_ENV := templates from script format
define discard_env
$(foreach var,$(DISCARD_ENV),$(eval undefine $(var)))
endef
ARTIFACTS := build/a build/b
# In this situation: defining a variable that has been undefined
# in the foreach loop befaure causes the segfault:
templates := t1.tpl t2.tpl # <----
format := qcow2
.PHONY: all
all: $(ARTIFACTS)
$(ARTIFACTS):
@echo $@