🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2297

Misleading line number on warning

#2297
From: satz
Date: Tue, 14 Feb 1989 09:00
34 lines
1416 bytes
The following program when compiled with gcc 1.33 on a Sun 3/280 OS 3.5
with the -W flag produces a warning with the incorrect line number. The
line number reported is at the end of the block instead of the for
statement.

------------------------------
struct list {
    struct list *next;
    char *a;
} *foo;

main()
{
    struct list *p;

    for (p = foo; p; p->next) {		/* missing assignment */
	printf("a=%s\n", p->a);
	printf("length=%d", strlen(p->a));
    }
}
------------------------------

dustbin>gcc -W -c -v -B$g/ foo.c
gcc version 1.32
 /usr.MC68020/dustbin/src/gnu/gcc-1.33/cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun
-Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 foo.c /tmp/
cca00410.cpp
GNU CPP version 1.33
 /usr.MC68020/dustbin/src/gnu/gcc-1.33/cc1 /tmp/cca00410.cpp -quiet -dumpbase fo
o.c -W -version -o /tmp/cca00410.s
GNU C version 1.33 (68k, MIT syntax) compiled by GNU C version 1.33.
foo.c: In function main:
foo.c:13: warning: statement with no effect
 as -mc68020 /tmp/cca00410.s -o foo.o
Technical Details
Message-ID: <8902140841.AA27110@prep.ai.mit.edu>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!CISCO.COM!satz

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!CISCO.COM!satz
From: satz@CISCO.COM
Newsgroups: gnu.gcc.bug
Subject: Misleading line number on warning
Message-ID: <8902140841.AA27110@prep.ai.mit.edu>
Date: 14 Feb 89 09:00:36 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 34