Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ucsd!orion.cf.uci.edu!uci-ics!glacier.ics.uci.edu!schmidt From: schmidt@glacier.ics.uci.edu (Doug Schmidt) Newsgroups: comp.lang.c Subject: Re: gcc bug (possibly) Message-ID: <8626@paris.ics.uci.edu> Date: 4 Mar 89 22:22:45 GMT References: <9201@orstcs.CS.ORST.EDU> Sender: news@paris.ics.uci.edu Reply-To: Doug Schmidt Organization: University of California at Irvine: ICS Dept. Lines: 54 In article <9201@orstcs.CS.ORST.EDU> budd@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@prep.ai.mit.edu with a quote from the latest version of the dpANS standard to substantiate your claim. thanks, Doug Schmidt -- schmidt@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.