0:08
To: tinycc-devel@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 corre
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
m: tinycc-devel-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:
> Man
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("fa
printf("fails %08x\n", (~0) >> 1);
}
Christian
-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
Subj
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;
} e
Of
grischka
Sent: Monday, December 29, 2008 19:59
To: tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] wrong preprocessor shift operation
Christian Jullien wrote:
> Simple code below is wrong, even when forcing to long or unsigned long :
>
> printf("%08x\n", ((~0) &
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
ter fix. You may also check
if 0x is valid for TCC_TARGET_X86_64
Christian
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, 200
Hello team,
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
10 matches
Mail list logo