Date: Tue, 20 Jan 1998 14:57:51 -0500 (EST) From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> To: Terry Lambert <tlambert@primenet.com> Cc: current@FreeBSD.ORG Subject: Nasty GCC bug? Message-ID: <199801201957.OAA14543@khavrinen.lcs.mit.edu> In-Reply-To: <199801201933.MAA27126@usr04.primenet.com> References: <199801201933.MAA27126@usr04.primenet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
<<On Tue, 20 Jan 1998 19:33:18 +0000 (GMT), Terry Lambert <tlambert@primenet.com> said: > /* > * demonstrate bug with signed smaller-than-int arguments to > * varradic functions... > */ It's no bug, Terry... just ISO 9899:1990 in action. > What is happening is that the value is being sign-extended to int > when it is pushed on the stack. Which is precisely what is supposed to happen, since in the absence of an explicit type for that argument, the default promotions prevail, and the default promotion of `signed short' is to `signed int'. Of course, the correct type to pass for the `%x' format descriptor is `unsigned int', so you should have cast the argument explicitly. You might call it a bug in gcc that `-Wformat' does not diagnose this condition. -GAWollman -- Garrett A. Wollman | O Siem / We are all family / O Siem / We're all the same wollman@lcs.mit.edu | O Siem / The fires of freedom Opinions not those of| Dance in the burning flame MIT, LCS, CRS, or NSA| - Susan Aglukark and Chad Irschick
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801201957.OAA14543>
