Article View: gnu.gcc.bug
Article #2576Bug in 1.35 prototype handling...
From: Mike Meyer, I'll think of someth...
Date: Fri, 28 Apr 1989 22:43
Date: Fri, 28 Apr 1989 22:43
46 lines
1903 bytes
1903 bytes
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
Technical Details
Message-ID:
<8904282243.AA10670@violet.berkeley.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!VIOLET.BERKELEY.EDU!mwmShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!VIOLET.BERKELEY.EDU!mwm From: mwm@VIOLET.BERKELEY.EDU (Mike Meyer, I'll think of something yet) Newsgroups: gnu.gcc.bug Subject: Bug in 1.35 prototype handling... Message-ID: <8904282243.AA10670@violet.berkeley.edu> Date: 28 Apr 89 22:43:56 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 46