[gnu.gcc.bug] Bug in 1.35 prototype handling...

mwm@VIOLET.BERKELEY.EDU (Mike Meyer, I'll think of something yet) (04/29/89)

The following short program illustrates what appears to be bugs in the
handling of prototypes in gcc-1.35, configured for a 4BSD vax:

void	test(struct gort *z) ;

struct gort {
	int x ;
	} ;

void
#ifdef	FULLPROTO
test(struct gort *z) {
#else
test(z) struct gort *z; {
#endif
	z -> x = 3 ;
	}


The output from two different compilations is:

% gcc proto.c
proto.c:1: warning: `struct gort' declared inside parameter list
proto.c:1: warning: such a name is accessible only within its parameter list,
proto.c:1: warning: which is probably not what you want.
proto.c: In function test:
proto.c:11: argument `z' doesn't match function prototype
% gcc -DFULLPROTO proto.c
proto.c:1: warning: `struct gort' declared inside parameter list
proto.c:1: warning: such a name is accessible only within its parameter list,
proto.c:1: warning: which is probably not what you want.
proto.c: In function test:
proto.c:9: conflicting types for `test'
proto.c:1: previous declaration of `test'


The problem is the errors on each compile. Prototypes don't get
forward references in the same way structure declarations do. This
seems blatantly wrong. Hower, it may well be the way ANSI specified
things - I don't have the most recent draft to check. If so, please
let me know. I would also suggest making the type clash in this case a
warning instead of an error, or ignoring it, and using the current
behavior if -pedantic is on.

	Thanx,
	<mike