[gnu.utils.bug] Two bugs in Make 3.54

montnaro@sprite.crd.ge.com (Skip Montanaro) (08/09/89)

    I believe at least one of these bugs was reported before, but I didn't
    see either one during a quick check of the unexpired articles for this
    group. Sorry if these are repeats. The following makefile


MYLIB_SRCS = myfile1.c myfile2.c
MYLIB_OBJS = $(MYLIB_SRCS:%.c=mylib(%.o))

MYLIB_TMP = $(MYLIB_SRCS:%.c=%.o)
MYLIB_OBJS2 = $(foreach f,$(MYLIB_TMP),mylib($f) )

all :
	echo $(MYLIB_SRCS)
	echo $(MYLIB_OBJS)
	echo $(MYLIB_TMP)
	echo $(MYLIB_OBJS2)


    gives the following output:


sprite% gmake -k -n
echo myfile1.c myfile2.c
echo mylib(myfile1.o mylib(myfile2.o)
echo myfile1.o myfile2.o
Bus error - core dumped
sprite% 


    One error is in the generation of MYLIB_OBJS. Note the missing paren in
    the second line of output.

    The core file seems to be generated as a result of evaluating the
    foreach construct. For those interested in such things, the traceback
    follows.  (I wrapped the lines to avoid potential 80-column willies.)

sprite% gdb ~/src/gmake/make-sun3 core
GDB 3.1.1, Copyright (C) 1988 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "info copying" to see the conditions.
Reading symbol data from /home/kreskin/u0/montnaro/src/gmake/make-sun3...done.
Core file is from "make-sun3".
Program terminated with signal 10, Bus error.
Type "help" for a list of commands.
(gdb) bt
#0  0xecdd10e in ?? ()
#1  0x3ec0 in fatal_error_signal (sig=10) (../commands.c line 442)
#2  0xecc17e4 in ?? ()
#3  0xdc9e in define_variable (name=(char *) 0x2ff24 "f", length=1, 
	value=(char*) 0x23298 "", origin=o_automatic, recursive=0) 
	(../variable.c line 127)
#4  0xfc1a in expand_function (o=(char *) 0x2fd80 "", 
	function=function_foreach, text=(char *) 0x2fe4c "mylib($f) ", 
	end=(char *) 0x31d9b ")")
	(../function.c line 580)
#5  0x11002 in handle_function (op=(char **) 0xeffebfc, 
	stringp=(char **) 0xeffebf8)
	(../function.c line 1107)
#6  0xeaca in variable_expand (line=(char *) 0x31d78 
	"$(foreach f,$(MYLIB_TMP),mylib($f) )")
	(../expand.c line 94)
#7  0xef06 in variable_expand_for_file (line=(char *) 0x31d78 
	"$(foreach f,$(MYLIB_TMP),mylib($f) )", file=(struct file *) 0x0) 
	(../expand.c line 263)
#8  0xefae in allocated_variable_expand_for_file (line=(char *) 0x31d78 
	"$(foreach f,$(MYLIB_TMP),mylib($f) )", file=(struct file *) 0x0) 
	(../expand.c line 297)
#9  0xef80 in allocated_variable_expand (line=(char *) 0x31d78 
	"$(foreach f,$(MYLIB_TMP),mylib($f) )") (../expand.c line 282)
#10 0xe9f2 in recursively_expand (v=(struct variable *) 0x31d50) 
	(../expand.c line 38)
#11 0xed96 in variable_expand (line=(char *) 0x2cf90 "\techo $(MYLIB_OBJS2)") 
	(../expand.c line 185)
#12 0xef38 in variable_expand_for_file (line=(char *) 0x2cf90 
	"\techo $(MYLIB_OBJS2)", file=(struct file *) 0x31e28) 
	(../expand.c line 269)
#13 0xefae in allocated_variable_expand_for_file (line=(char *) 0x2cf90 
	"\techo $(MYLIB_OBJS2)", file=(struct file *) 0x31e28) 
	(../expand.c line 297)
#14 0x4658 in start_job (child=(struct child *) 0x2cfb4) (../job.c line 393)
#15 0x47d2 in start_job (child=(struct child *) 0x2cfb4) (../job.c line 474)
#16 0x47d2 in start_job (child=(struct child *) 0x2cfb4) (../job.c line 474)
#17 0x47d2 in start_job (child=(struct child *) 0x2cfb4) (../job.c line 474)
#18 0x3cea in execute_file_commands (file=(struct {...} *) 0x31e28) 
	(../commands.c line 343)
#19 0xb93e in remake_file (file=(struct {...} *) 0x31e28) 
	(../remake.c line 618)
#20 0xb3ae in update_file_1 (file=(struct {...} *) 0x31e28, depth=0) 
	(../remake.c line 394)
#21 0xabd6 in update_file (file=(struct {...} *) 0x31e28, depth=0) 
	(../remake.c line 169)
#22 0xaa5a in update_goal_chain (goals=(struct {...} *) 0x2c9b0, makefiles=0) 
	(../remake.c line 93)
#23 0x798a in main (argc=3, argv=(char **) 0xefffaec, envp=(char **) 0xefffafc)
	(../main.c line 769)
(gdb)
--
Skip Montanaro (montanaro@sprite.crd.ge.com)