tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] wrong preprocessor shift operation


From: grischka
Subject: Re: [Tinycc-devel] wrong preprocessor shift operation
Date: Tue, 30 Dec 2008 17:32:57 +0100
User-agent: Thunderbird 2.0.0.18 (X11/20081125)

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 ;)





reply via email to

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