Christian Jullien wrote:
I think you're right.
Bug occurs when int (0x) is promoted to long long
(0x). Then right shift and back to int conversion returns a
false result.
Another possible fix is to cast to (unsigned int) as with
if (t1 == VT_LLONG) {
l1 = v1-c.ll;
}
-Original Message-
From: tinycc-devel-bounces+eligis=wanadoo...@nongnu.org
[mailto:tinycc-devel-bounces+eligis=wanadoo...@nongnu.org] On Behalf Of
grischka
Sent: Tuesday, December 30, 2008 15:35
To: tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] wrong preprocessor shift operation
Christian Jullien wrote:
Many thanks, I tested your fix but I still have a broken case:
int
main()
{
unsigned int x = 0x;
unsigned int y = 1;
printf(fixed %08x\n, x y);
printf(fixed %08x\n, (~(unsigned int)0) (unsigned int)1);
printf(fails
-bounces+eligis=wanadoo...@nongnu.org
[mailto:tinycc-devel-bounces+eligis=wanadoo...@nongnu.org] On Behalf Of
grischka
Sent: Tuesday, December 30, 2008 17:33
To: tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] wrong preprocessor shift operation
Christian Jullien wrote:
Many thanks, I tested
On Tue, Dec 30, 2008 at 05:32:57PM +0100, grischka wrote:
Christian Jullien wrote:
printf(fails %08x\n, (~0) 1);
fails
Maybe gcc is not correct but then I need an exact explanation why ;)
0 has type int. On x86 the representation is 32 value bits set to
zero, with no padding
@nongnu.org
Subject: Re: [Tinycc-devel] wrong preprocessor shift operation
On Tue, Dec 30, 2008 at 05:32:57PM +0100, grischka wrote:
Christian Jullien wrote:
printf(fails %08x\n, (~0) 1);
fails
Maybe gcc is not correct but then I need an exact explanation why ;)
0 has type int
Christian Jullien wrote:
Simple code below is wrong, even when forcing to long or unsigned long :
printf(%08x\n, ((~0) 1));
printf(%08x\n, (unsigned long)((~(unsigned long)0) 1));
printf(%08x\n, (long)((~(long)0) 1));
It prints
while 7fff is
From: tinycc-devel-bounces+eligis=wanadoo...@nongnu.org
[mailto:tinycc-devel-bounces+eligis=wanadoo...@nongnu.org] On Behalf Of
Christian Jullien
Sent: Sunday, December 28, 2008 9:26
To: tinycc-devel@nongnu.org
Subject: [Tinycc-devel] wrong preprocessor shift operation
Hello team,
Simple