Path: 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 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