[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Isolated bug

From: Dave Dodge
Subject: Re: [Tinycc-devel] Isolated bug
Date: Sat, 12 May 2007 22:45:43 -0400
User-agent: Mutt/1.5.12-2006-07-14

On Sat, May 12, 2007 at 08:31:36PM +0200, Philippe Ribet wrote:
> I just succeed in isolating a tcc bug from a very large piece of software:
>  printf("%d\n",INT64_C(0)>=(INT64_C(-2147483648)));

Invokes undefined behavior.  According to 7.18.4p2, the argument to
INT64_C() must be an integer constant.  Despite appearances,
-2147483648 is not an integer constant.  C does not have negative
integer constants.

What -2147483648 _is_, is an integer constant expression applying the
unary negation operator to the integer constant 2147483648.  If you're
trying to do this in real code, use something like this instead:


                                                  -Dave Dodge

reply via email to

[Prev in Thread] Current Thread [Next in Thread]