Warning
Alexandre Oliva
oliva@lsd.ic.unicamp.br
Wed Feb 2 00:50:00 GMT 2000
On Feb 2, 2000, Richard Henderson <rth@cygnus.com> wrote:
> On Wed, Feb 02, 2000 at 01:54:17AM -0200, Alexandre Oliva wrote:
>> It's a nuisance in the C standard. There's no such thing as a
>> negative literal integer. `-2147483648' is parsed as two separate
>> tokens: `-', the unary negation operator, and `2147483648', an integer
>> literal, that doesn't fit in a signed integer, so GCC assumes it is
>> unsigned.
> Incorrect on both counts. The formation is quite well defined,
> it just doesn't have the type you expect. It's still unsigned.
Yep, but it's being assigned to a signed int, so he gets overflow,
thus, undefined (unspecified?) behavior.
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them
More information about the Gcc-bugs
mailing list