Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!BU-IT.BU.EDU!budd From: budd@BU-IT.BU.EDU (Phil Budne) Newsgroups: gnu.gcc.bug Subject: gcc -Wshadow bug in 1.36 and 1.37.1 Message-ID: <9003010535.AA24462@bu-it.bu.edu> Date: 1 Mar 90 05:35:33 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 66 Summary: undeclared variables (within functions) cause spurious shadow warnings for argument declarations in in gcc versions 1.36 & 1.37.1 on Sun4 (and Sun3). The spurious warning is output twice! Once at "top level" and once in the new function. Wishes: -WALL turned on ALL warnings and that -w could be used to subtract from the warning set. i.e. gcc -WALL -wcomment Repeat By: Script started on Thu Mar 1 00:20:25 1990 bu-it% cat xxx.c struct { int member; } x; extern void boring( int arg ); # ifdef BUG void a(void) { boring( member ); /* typo (x.member) */ } # endif void b( int member ) { boring( member ); } bu-it% gcc -v gcc version 1.36 bu-it% arch sun4 bu-it% gcc -c -Wshadow xxx.c bu-it% gcc -c -Wshadow -DBUG xxx.c xxx.c: In function a: xxx.c:9: `member' undeclared (first use this function) xxx.c:9: (Each undeclared identifier is reported only once xxx.c:9: for each function it appears in.) xxx.c: At top level: xxx.c:13: warning: declaration of `member' shadows global declaration xxx.c: In function b: xxx.c:13: warning: declaration of `member' shadows global declaration bu-it% rsh pub !-4 rsh pub gcc -v gcc version 1.37.1 bu-it% rsh pub !-4 rsh pub arch sun4 bu-it% rsh pub !-4 rsh pub gcc -c -Wshadow xxx.c bu-it% rsh pub !-4 rsh pub gcc -c -Wshadow -DBUG xxx.c xxx.c: In function a: xxx.c:9: `member' undeclared (first use this function) xxx.c:9: (Each undeclared identifier is reported only once xxx.c:9: for each function it appears in.) xxx.c: At top level: xxx.c:13: warning: declaration of `member' shadows global declaration xxx.c: In function b: xxx.c:13: warning: declaration of `member' shadows global declaration bu-it% exit script done on Thu Mar 1 00:23:21 1990