[gnu.utils.bug] Bug in GNU Make

tsilva%aaec1.UUCP@DSPVAX.MIT.EDU (Tony Silva) (03/28/89)

Hi! First let me just say that you guys at FSF are creating some
really fantastic software. I have installed most of the latest GNU
code on all our machines (mostly Sun-3's).  I (and everyone else here
at Atlantic) use Emacs every day, ALL day.  There probably aren't many
features or key bindings I don't use all the time.  As for gdb, it
blows the doors off of dbx.  And finally, I'm a big fan of C, but do a
lot of work which could benefit from simpler standard I/O (no more
printf() format strings) and complex math (no more zmul(z1, z2) for z1
* z2, etc.), and therefore am looking forward to using your C++
compiler on a daily basis.  I try to get everyone I know, both here
and at other companies or universities, using GNU software since it is
so clean and powerful (and free to boot!).  Keep up the great work!

I'm writing to report a bug in GNU make (which is otherwise really
great -- extremely well thought out).  The bug shows up on a Sun 3/160
running Sun OS 3.2 (host "aaec1"). It does not show up on a Sun 3/280
running Sun OS 4.0.1, but I believe that it is still a bug in the
source code.

    tsilva@aaec1> cd /loc/new/make

    tsilva@aaec1> make -f /dev/null -p
    ...						(lots of output)
    MAKEFLAGS (environment) := -j1 -S
    FC (default) := f77
    CO (default) := co
    PC (default) := pc
    AR (default) := ar r
    IOT trap (core dumped)			(OH-OH!!!)

    tsilva@aaec1> gdb make core
    Reading symbol data from /loc/new/make/make...done.
    Core file is from "make".
    Program terminated with signal 6, IOT trap.
    (gdb) i st
    #0  0x129d4 in kill ()
    #1  0x10d74 in _sigtramp ()
    #2  0xd880 in print_variable_data_base () (variable.c line 1730)
    #3  0x59dc in print_data_base () (make.c line 961)
    #4  0x5290 in main (argc=4, argv=(char **) 0xefffdbc, envp=(char **) 0xefffdd0)
    (make.c line 690)
    (gdb) up
    #1  0x10d74 in _sigtramp ()
    (gdb)
    #2  0xd880 in print_variable_data_base () (variable.c line 1730)
    1730                abort ();
    (gdb) p v->origin
    $1 = 200
    (gdb) q

v->origin should be an enum "variable_origin" value like "o_file"
("200" is a garbage value).  I ran lint(1) on all the GNU make
sources. The bug is indicated by the line:

    define_variable: variable # of args.    variable.c(80)  ::  variable.c(182)

in the lint output below.

    tsilva@aaec1> cat -n variable.c | fgrep 182
       182      (void) define_variable ("MAKELEVEL", 9, buf);

I believe this line should read:

       182      (void) define_variable ("MAKELEVEL", 9, buf, o_file, 0);

(Maybe "o_file" should be some other enum value.) Can you send me an E-mail
note whether I'm right or wrong? I'd really appreciate it.

To all you guys at FSF, thanks again for all the great software.

Tony Silva

Atlantic Aerospace Electronics Corp.	ARPA: tsilva%aaec1.UUCP@dspvax.MIT.EDU
470 Totten Pond Road			UUCP: ...!seismo!dspvax!aaec1!tsilva
Waltham, MA 02154
(617)890-4200

-----------------------------------------------------------------------------
Here's the rest of the lint output (can most of this be cleaned up too?):

    tsilva@aaec1> lint *.c
    ar.c:
    arscan.c:
    commands.c:
    dir.c:
    file.c:
    glob.c:
    make.c:
    make.c(476): warning: len unused in function main
    make.c(1195): warning: argument s6 unused in function error
    read.c:
    read.c(362): warning: commands_started may be used before set
    remake.c:
    remake.c(514): warning: statement not reached
    remake.c(521): warning: statement not reached
    remake.c(524): warning: statement not reached
    remake.c(526): warning: statement not reached
    remake.c(528): warning: statement not reached
    remake.c(536): warning: statement not reached
    rule.c:
    variable.c:
    version.c:
    vpath.c:
    vpath.c(191): warning: st unused in function construct_vpath_list
    Lint pass2:
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  ar.c(59)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  ar.c(60)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  ar.c(97)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  ar.c(98)
    f_mtime value declared inconsistently   remake.c(572)  ::  ar.c(102)
    free value declared inconsistently      llib-lc(278)  ::  ar.c(126)
    sprintf value declared inconsistently   llib-lc(512)  ::  arscan.c(308)
    bcopy value declared inconsistently     llib-lc(207)  ::  arscan.c(221)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  commands.c(547)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  commands.c(549)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  commands.c(553)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  commands.c(565)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  commands.c(570)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  commands.c(573)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  commands.c(576)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  commands.c(605)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  commands.c(610)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  commands.c(650)
    xmalloc, arg. 1 used inconsistently     make.c(1244)  ::  commands.c(718)
    xmalloc, arg. 1 used inconsistently     make.c(1244)  ::  commands.c(721)
    sprintf value declared inconsistently   llib-lc(512)  ::  commands.c(193)
    bcopy value declared inconsistently     llib-lc(207)  ::  commands.c(610)
    free value declared inconsistently      llib-lc(278)  ::  commands.c(665)
    abort value declared inconsistently     llib-lc(197)  ::  commands.c(730)
    _exit value declared inconsistently     llib-lc(57)  ::  commands.c(462)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  dir.c(93)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  dir.c(264)
    bzero value declared inconsistently     llib-lc(209)  ::  dir.c(256)
    bcopy value declared inconsistently     llib-lc(207)  ::  dir.c(286)
    bzero value declared inconsistently     llib-lc(209)  ::  file.c(94)
    free value declared inconsistently      llib-lc(278)  ::  file.c(211)
    abort value declared inconsistently     llib-lc(197)  ::  file.c(124)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  glob.c(373)
    malloc, arg. 1 used inconsistently      llib-lc(349)  ::  glob.c(379)
    malloc, arg. 1 used inconsistently      llib-lc(349)  ::  glob.c(422)
    malloc, arg. 1 used inconsistently      llib-lc(349)  ::  glob.c(426)
    free, arg. 1 used inconsistently        llib-lc(278)  ::  glob.c(436)
    free, arg. 1 used inconsistently        llib-lc(278)  ::  glob.c(482)
    realloc, arg. 1 used inconsistently     llib-lc(392)  ::  glob.c(527)
    realloc, arg. 2 used inconsistently     llib-lc(392)  ::  glob.c(527)
    free, arg. 1 used inconsistently        llib-lc(278)  ::  glob.c(531)
    free, arg. 1 used inconsistently        llib-lc(278)  ::  glob.c(537)
    bcopy value declared inconsistently     llib-lc(207)  ::  glob.c(373)
    free value declared inconsistently      llib-lc(278)  ::  glob.c(537)
    define_variable, arg. 2 used inconsistently     variable.c(80)  ::  make.c(324)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  make.c(746)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  make.c(796)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  make.c(1136)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  make.c(1138)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  make.c(1140)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  make.c(1270)
    strncmp, arg. 3 used inconsistently     llib-lc(432)  ::  make.c(1294)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  make.c(1411)
    bcopy value declared inconsistently     llib-lc(207)  ::  make.c(1409)
    free value declared inconsistently      llib-lc(278)  ::  make.c(633)
    abort value declared inconsistently     llib-lc(197)  ::  make.c(1017)
    sprintf value declared inconsistently   llib-lc(512)  ::  make.c(911)
    exit value declared inconsistently      llib-lc(273)  ::  make.c(1169)
    mktemp value declared inconsistently    llib-lc(356)  ::  make.c(483)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  read.c(112)
    do_define, arg. 2 used inconsistently   read.c(569)  ::  read.c(318)
    do_define, arg. 2 used inconsistently   read.c(569)  ::  read.c(335)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  read.c(357)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  read.c(422)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  read.c(534)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  read.c(611)
    alloca, arg. 1 used inconsistently      dir.c(211)  ::  read.c(757)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  read.c(758)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  read.c(923)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  read.c(999)
    strncmp, arg. 3 used inconsistently     llib-lc(432)  ::  read.c(1047)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  read.c(1119)
    qsort, arg. 2 used inconsistently       llib-lc(385)  ::  read.c(1308)
    bzero value declared inconsistently     llib-lc(209)  ::  read.c(358)
    bcopy value declared inconsistently     llib-lc(207)  ::  read.c(758)
    free value declared inconsistently      llib-lc(278)  ::  read.c(1317)
    qsort value declared inconsistently     llib-lc(385)  ::  read.c(1308)
    update_file, arg. 2 used inconsistently remake.c(143)  ::  remake.c(86)
    lseek value used inconsistently llib-lc(94)  ::  remake.c(525)
    lseek value declared inconsistently     llib-lc(94)  ::  remake.c(525)
    free value declared inconsistently      llib-lc(278)  ::  remake.c(643)
    abort value declared inconsistently     llib-lc(197)  ::  remake.c(212)
    alloca, arg. 1 used inconsistently      dir.c(211)  ::  rule.c(333)
    alloca, arg. 1 used inconsistently      dir.c(211)  ::  rule.c(337)
    alloca, arg. 1 used inconsistently      dir.c(211)  ::  rule.c(340)
    alloca, arg. 1 used inconsistently      dir.c(211)  ::  rule.c(345)
    alloca, arg. 1 used inconsistently      dir.c(211)  ::  rule.c(353)
    alloca, arg. 1 used inconsistently      dir.c(211)  ::  rule.c(361)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  rule.c(561)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  rule.c(567)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  rule.c(595)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  rule.c(625)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  rule.c(799)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  rule.c(803)
    alloca, arg. 1 used inconsistently      dir.c(211)  ::  rule.c(905)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  rule.c(914)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  rule.c(935)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  rule.c(943)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  rule.c(958)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  rule.c(967)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  rule.c(1084)
    define_variable, arg. 2 used inconsistently     variable.c(80)  ::  rule.c(1181)
    bzero value declared inconsistently     llib-lc(209)  ::  rule.c(620)
    bcopy value declared inconsistently     llib-lc(207)  ::  rule.c(967)
    free value declared inconsistently      llib-lc(278)  ::  rule.c(1121)
    abort value declared inconsistently     llib-lc(197)  ::  rule.c(1128)
    strncmp, arg. 3 used inconsistently     llib-lc(432)  ::  variable.c(92)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  variable.c(102)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  variable.c(113)
    strncmp, arg. 3 used inconsistently     llib-lc(432)  ::  variable.c(144)
    define_variable: variable # of args.    variable.c(80)  ::  variable.c(182)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  variable.c(186)
    define_variable, arg. 2 used inconsistently     variable.c(80)  ::  variable.c(2
    71)
    variable_buffer_output, arg. 3 used inconsistently      variable.c(1559)  ::  va
    riable.c(297)
    variable_buffer_output, arg. 3 used inconsistently      variable.c(1559)  ::  va
    riable.c(307)
    variable_buffer_output, arg. 3 used inconsistently      variable.c(1559)  ::  va
    riable.c(335)
    subst_expand, arg. 5 used inconsistently        variable.c(290)  ::  variable.c(
    361)
    subst_expand, arg. 6 used inconsistently        variable.c(290)  ::  variable.c(
    361)
    variable_buffer_output, arg. 3 used inconsistently      variable.c(1559)  ::  va
    riable.c(420)
    variable_buffer_output, arg. 3 used inconsistently      variable.c(1559)  ::  va
    riable.c(431)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  variable.c(555)
    read, arg. 3 used inconsistently        llib-lc(120)  ::  variable.c(661)
    lookup_variable, arg. 2 used inconsistently     variable.c(132)  ::  variable.c(
    711)
    qsort, arg. 2 used inconsistently       llib-lc(385)  ::  variable.c(774)
    savestring, arg. 2 used inconsistently  make.c(1267)  ::  variable.c(837)
    variable_buffer_output, arg. 3 used inconsistently      variable.c(1559)  ::  va
    riable.c(865)
    variable_buffer_output, arg. 3 used inconsistently      variable.c(1559)  ::  va
    riable.c(943)
    variable_buffer_output, arg. 3 used inconsistently      variable.c(1559)  ::  va
    riable.c(1070)
    subst_expand, arg. 5 used inconsistently        variable.c(290)  ::  variable.c(
    1108)
    subst_expand, arg. 6 used inconsistently        variable.c(290)  ::  variable.c(
    1108)
    variable_buffer_output, arg. 3 used inconsistently      variable.c(1559)  ::  va
    riable.c(1180)
    variable_buffer_output, arg. 3 used inconsistently      variable.c(1559)  ::  va
    riable.c(1267)
    variable_buffer_output, arg. 3 used inconsistently      variable.c(1559)  ::  va
    riable.c(1353)
    strncmp, arg. 3 used inconsistently     llib-lc(432)  ::  variable.c(1393)
    variable_buffer_output, arg. 3 used inconsistently      variable.c(1559)  ::  va
    riable.c(1453)
    lookup_variable, arg. 2 used inconsistently     variable.c(132)  ::  variable.c(
    1479)
    lookup_variable, arg. 2 used inconsistently     variable.c(132)  ::  variable.c(
    1489)
    variable_buffer_output, arg. 3 used inconsistently      variable.c(1559)  ::  va
    riable.c(1505)
    variable_buffer_output, arg. 3 used inconsistently      variable.c(1559)  ::  va
    riable.c(1509)
    variable_buffer_output, arg. 3 used inconsistently      variable.c(1559)  ::  va
    riable.c(1536)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  variable.c(1571)
    xmalloc, arg. 1 used inconsistently     make.c(1244)  ::  variable.c(1618)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  variable.c(1674)
    sprintf value declared inconsistently   llib-lc(512)  ::  variable.c(1626)
    bcopy value declared inconsistently     llib-lc(207)  ::  variable.c(1674)
    free value declared inconsistently      llib-lc(278)  ::  variable.c(1679)
    abort value declared inconsistently     llib-lc(197)  ::  variable.c(1730)
    qsort value declared inconsistently     llib-lc(385)  ::  variable.c(774)
    _exit value declared inconsistently     llib-lc(57)  ::  variable.c(635)
    alloca, arg. 1 used inconsistently      dir.c(211)  ::  vpath.c(304)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  vpath.c(313)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  vpath.c(320)
    bcopy, arg. 3 used inconsistently       llib-lc(207)  ::  vpath.c(343)
    bcopy value declared inconsistently     llib-lc(207)  ::  vpath.c(343)
    free value declared inconsistently      llib-lc(278)  ::  vpath.c(235)
    signal returns value which is sometimes ignored
    strcat returns value which is always ignored
    strcpy returns value which is always ignored
    strncpy returns value which is always ignored
    fclose returns value which is always ignored
    fflush returns value which is always ignored
    _flsbuf returns value which is always ignored
    fprintf returns value which is always ignored
    printf returns value which is always ignored
    sprintf returns value which is always ignored
    sscanf returns value which is always ignored
    close returns value which is always ignored
    fstat returns value which is sometimes ignored

Damon.Lipparelli@CS.CMU.EDU (08/01/89)

Hello.  I want to report what I believe is a bug in gnu make.  Using the
following
minimal makefile:

.SUFFIXES: .o .a

.o.a : $<
	ar uv $@ $<

If I have a file called test.o (made with cc -c test.c), and try make
test.a, I get 
"make: *** No way to make target 'test.a'.  Stop."

This does work with the normal make that is on my system.

The version of gnu make I'm using is:

GNU Make version 3.54, by Richard Stallman and Roland McGrath.
Copyright (C) 1988, 1989 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

Damon Lipparelli
(lipp@miracle.edrc.cmu.edu)
EDRC
Carnegie Mellon University
Pittsburgh, Pa
		15213

Daniel.Stodolsky@MIRACLE.EDRC.CMU.EDU (08/02/89)

This bug occurs on both systems I've tested it on - a sun3 (mach BSD 4.3)
and an hp 835 (hp-ux 6.5). The problem is with gnu make finding executables
to run. In particular, in my home directory I have a subdirectory call 'co'.
When the gnu make rule to automatically checkout a file from RCS fires,
gnu make attempts to execute the directory (my home directory is in the search
path). So while gnu-make does find the first co in my path that is executable,
it is not checking for wether or not the executable happens to be a directory.

	Dan Stodolsky
	danner@edrc.cmu.edu

mark@deltam.com (mark galbraith) (01/18/90)

When using the -j command line option on a target with many dependancies (e.g.,
linking several .o files into a single executable), make is not waiting for the
jobs building the dependacy files to finish before attempting to start the final
target build.

In example, consider the following entry in a Makefile:

	prog:	modulea.o moduleb.o modulec.o

Even by using the default rules for everything, if you start make with the -j
option set to 4, make will start the three compiles for modulea, moduleb, and
modulec; and then, without waiting for those jobs to finish, will also start
the link of prog.

What I would have expected to occur is that the make checks to see if a job is
dependant on one or more jobs still running.  If so, skip this job for now, leaving
it at the top of the list of jobs that must be done, and start the next job on
the job list.  Each time a job finishes, check from the top of the list down to
find the first job that can be run, that doesn't depend on a job that is currently
running.  If no job can be found, sleep until the next job terminates.  Eventually
all of the dependancy jobs will finish for the target, and the dependant job will
be run.

What I am asking for may be too much to ask (I haven't had much of a chance to
look into the code that handles jobs), but I would be interested in devoting what
time I have in fixing this problem.  I can't guarantee much, but what is available
will have to do.  Let me know if you would like me to pursue this bug.
--
Mark Galbraith				Voice:  415-449-6881
Programmer/Postmaster			UUCP:   uunet!deltam!mark
System Administrator			Domain: mark@deltam.com