[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 16:50:00 +0100 |
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
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
grischka
Sent: Tuesday, December 30, 2008 15:35
To: address@hidden
Subject: Re: [Tinycc-devel] wrong preprocessor shift operation
Christian Jullien wrote:
> I think you're right.
> Bug occurs when int (0xffffffff) is promoted to long long
> (0xffffffffffffffff). 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;
> } else {
> l1 = (unsigned int)v1->c.i;
> }
>
> For my test case it works but will probably break many things.
>
> As professional software developer I know how long it takes to test
> everything after a fix. This fix can break many things and I don't want
> (have to time) to become a TinyCC maintainer.
>
> I think that long long computation/promotion should only occur when type
is
> declared as long long.
>
> I let you decide how you want to address this bug.
Well, then thanks for reporting. I pushed a fix on the mob branch.
http://repo.or.cz/w/tinycc.git?a=commitdiff;h=1fe4008fa3472ad0ae23f3901b64f9
995a08952d
_______________________________________________
Tinycc-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/tinycc-devel
----------------------------------------------------------------------------
-----------
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.
- [Tinycc-devel] wrong preprocessor shift operation, Christian Jullien, 2008/12/28
- RE: [Tinycc-devel] wrong preprocessor shift operation, Christian Jullien, 2008/12/28
- Re: [Tinycc-devel] wrong preprocessor shift operation, grischka, 2008/12/29
- RE: [Tinycc-devel] wrong preprocessor shift operation, Christian Jullien, 2008/12/30
- Re: [Tinycc-devel] wrong preprocessor shift operation, grischka, 2008/12/30
- RE: [Tinycc-devel] wrong preprocessor shift operation,
Christian Jullien <=
- Re: [Tinycc-devel] wrong preprocessor shift operation, grischka, 2008/12/30
- RE: [Tinycc-devel] wrong preprocessor shift operation, Christian Jullien, 2008/12/30
- Re: [Tinycc-devel] wrong preprocessor shift operation, Dave Dodge, 2008/12/30
- RE: [Tinycc-devel] wrong preprocessor shift operation, Christian Jullien, 2008/12/31