[Top][All Lists]

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

RE: [Tinycc-devel] wrong preprocessor shift operation

From: Christian Jullien
Subject: RE: [Tinycc-devel] wrong preprocessor shift operation
Date: Tue, 30 Dec 2008 18:27:08 +0100

I've got the same result with VC++, LCC and DMC compiler so I assume it's
the correct behavior (I don't understand why).

Anyway, the reported bug is now fixed since my program correctly casts to
unsigned. Thanks for your time and your fix.


-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Sent: Tuesday, December 30, 2008 17:33
To: address@hidden
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 = 0xffffffff;
>       unsigned int y = 1;
>       printf("fixed %08x\n", x >> y);
>       printf("fixed %08x\n", (~(unsigned int)0) >> (unsigned int)1);
>       printf("fails %08x\n", (~0) >> 1);
> }
> Christian

But for me results are the same with gcc and tcc

$ gcc test.c -o test && ./test
fixed 7fffffff
fixed 7fffffff
fails ffffffff
$ ./tcc -run test.c
fixed 7fffffff
fixed 7fffffff
fails ffffffff

Maybe gcc is not correct but then I need an exact explanation why ;)

Tinycc-devel mailing list
Orange vous informe que cet  e-mail a ete controle par l'anti-virus mail. 
Aucun virus connu a ce jour par nos services n'a ete detecte.

reply via email to

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