tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Isolated bug


From: Philippe Ribet
Subject: Re: [Tinycc-devel] Isolated bug
Date: Sun, 13 May 2007 10:30:37 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5

Dave Dodge wrote:

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:

 -INT64_C(2147483648)


This give the very same result because of INT64_C definition:
/usr/include/stdint.h:
# define INT8_C(c)      c
# define INT16_C(c)     c
# define INT32_C(c)     c
# if __WORDSIZE == 64
#  define INT64_C(c)    c ## L
# else
#  define INT64_C(c)    c ## LL
# endif

So, it's definetly a tcc bug.

Best regards,

--
Philippe Ribet



                        The README file said
             "Requires Windows 95, NT 4.0, or better."
                   So... I installed it on Linux!





reply via email to

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