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.
__strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65
65      ../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or directory.
#0  __strlen_avx2 () at 
../sysdeps/x86_64/multiarch/strlen-avx2.S:65
#1  0x000055555556392f in allocated_variable_append 
(v=0x5555555b75f0) at ../../expand.c:540
#2  recursively_expand_for_file (v=v@entry=0x5555555b75f0, 
file=file@entry=0x5555555b7880)
    at ../../expand.c:138
#3  0x000055555557d88d in target_environment 
(file=<optimized out>) at ../../variable.c:1090
#4  0x000055555556ceb1 in start_job_command 
(child=child@entry=0x5555555bb780) at ../../job.c:1364
#5  0x000055555556d812 in start_waiting_job 
(c=c@entry=0x5555555bb780) at ../../job.c:1605
#6  0x000055555556de28 in new_job (file=0x5555555b7880) 
at ../../job.c:1878
#7  0x0000555555579d47 in remake_file 
(file=0x5555555b7880) at ../../remake.c:1234
#8  update_file_1 (depth=<optimized out>, 
file=0x5555555b7880) at ../../remake.c:835
#9  update_file (file=<optimized out>, depth=<optimized 
out>) at ../../remake.c:336
#10 0x000055555557a265 in check_dep 
(file=0x5555555b7880, depth=2, depth@entry=1, 
    this_mtime=this_mtime@entry=1, 
must_make_ptr=must_make_ptr@entry=0x7fffffffbffc) at 
../../remake.c:1024
#11 0x0000555555578fce in update_file_1 
(depth=<optimized out>, file=0x5555555b76c0) at 
../../remake.c:572
#12 update_file (file=file@entry=0x5555555b76c0, 
depth=<optimized out>) at ../../remake.c:336
#13 0x000055555557a6df in update_goal_chain 
(goaldeps=<optimized out>) at ../../remake.c:151
#14 0x000055555555ef3f in main (argc=<optimized out>, 
argv=<optimized out>, envp=<optimized out>)
    at ../../main.c: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 $@
  • Defining and ... Xavier Sanchez
    • Re: Defi... Dmitry Goncharov via Bug reports and discussion for GNU make

Reply via email to