[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: |
Sun, 28 Dec 2008 17:16:19 +0100 |
I played a little bit with sources and
F:\tmp\tinycc\win32>diff ..\tcc.BAK ..\tcc.c
5559,5560c5559,5572
< l1 = (t1 == VT_LLONG) ? v1->c.ll : v1->c.i;
< l2 = (t2 == VT_LLONG) ? v2->c.ll : v2->c.i;
---
>
> if (t1 == VT_LLONG) {
> l1 = v1->c.ll;
> } else {
> l1 = v1->c.i;
> l1 &= 0xffffffff;
> }
>
> if (t2 == VT_LLONG) {
> l2 = v2->c.ll;
> } else {
> l2 = v2->c.i;
> l2 &= 0xffffffff;
> }
Seems to fix it. Please check if there is no better fix. You may also check
if 0xffffffff is valid for TCC_TARGET_X86_64
Christian
________________________________________
From: address@hidden
[mailto:address@hidden On Behalf Of
Christian Jullien
Sent: Sunday, December 28, 2008 9:26
To: address@hidden
Subject: [Tinycc-devel] wrong preprocessor shift operation
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
ffffffff while 7fffffff is expected.
Hope it helps to improve this nice little compiler.
Christian
----------------------------------------------------------------------------
-----------
Orange vous informe que cet e-mail a été contrôlé par l'anti-virus mail.
Aucun virus connu à ce jour par nos services n'a été détecté.
- [Tinycc-devel] wrong preprocessor shift operation, Christian Jullien, 2008/12/28
- RE: [Tinycc-devel] wrong preprocessor shift operation,
Christian Jullien <=
- 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, 2008/12/30
- 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