[gnu.gcc.bug] gcc -Wshadow bug in 1.36 and 1.37.1

budd@BU-IT.BU.EDU (Phil Budne) (03/01/90)

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<name> 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