gcc bug (possibly)
Doug Schmidt
schmidt at glacier.ics.uci.edu
Sun Mar 5 08:22:45 AEST 1989
In article <9201 at orstcs.CS.ORST.EDU> budd at mist.cs.orst.edu (Tim Budd) writes:
++ Unless I am seriously mistaken in my understanding of prototypes, our version
++ of gcc produces an error in what I believe is a correct program.
++ Try the following:
++
++ extern int foo ( short );
++
++ int foo(x)
++ short x;
++ { ; }
++
++ I get a message that the argument doesn't match the prototype.
++ Works fine if I use int in place of short.
++
++ Anybody know if this has been fixed?
Since this ``bug'' in gcc is reported about once every 3 weeks let me
post the relevant section from the gcc.texinfo manual:
----------------------------------------
@item
Users often think it is a bug when GNU CC reports an error for code
like this:
@example
int foo (short);
int foo (x)
short x;
@{@dots{}@}
@end example
The error message is correct: this code really is erroneous, because the
old-style non-prototype definition passes subword integers in their
promoted types. In other words, the argument is really an @code{int},
not a @code{short}. The correct prototype is this:
@example
int foo (int);
@end example
----------------------------------------
If you don't agree with the gcc interpretation of ANSI proto-types,
please post a message to bug-gcc at prep.ai.mit.edu with a quote from the
latest version of the dpANS standard to substantiate your claim.
thanks,
Doug Schmidt
--
schmidt at ics.uci.edu (ARPA) | Per me si va nella citta' dolente.
office: (714) 856-4043 | Per me si va nell'eterno dolore.
| Per me si va tra la perduta gente.
| Lasciate ogni speranza o voi ch'entrate.
More information about the Comp.lang.c
mailing list