[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Buggy left shift on x86_64
From: |
grischka |
Subject: |
Re: [Tinycc-devel] Buggy left shift on x86_64 |
Date: |
Wed, 14 Mar 2012 13:14:45 +0100 |
User-agent: |
Thunderbird 2.0.0.24 (Windows/20100228) |
Thomas Preud'homme wrote:
Thanks for the input. The issue seems to be in tccpp.c parse_number function.
The code seems to assume that UL is unsigned int. The code I'm refering to is:
if (lcount == 2) {
if (tok == TOK_CINT)
tok = TOK_CLLONG;
else if (tok == TOK_CUINT)
tok = TOK_CULLONG;
}
We could add an ifdef statement to only do the lcount == 2 test if it's a 32
bit system but it seems really dirty. Or maybe targets could define the
programming model (LP64 & Co) and this could be use here.
Grishka, what do you think is the best approach?
I think best approach is to do both in sequential time order:
1) Add the required dirtiness in order to make it do the right thing.
2) Take benefit from exposed cleanup potential regarding #ifdefs dealing
with the target 'long' model
As for example tccgen.c:3050:
#if !defined TCC_TARGET_X86_64 || defined TCC_TARGET_PE
t = (t & ~VT_BTYPE) | VT_INT;
#else
t = (t & ~VT_BTYPE) | VT_LLONG;
#endif
Also with the 'long double' model, for example tccpe.c:1966:
#ifdef TCC_TARGET_PE
tok = TOK_CDOUBLE;
tokc.d = strtod(token_buf, NULL);
#else
tok = TOK_CLDOUBLE;
tokc.ld = strtold(token_buf, NULL);
#endif
Have Fun ;)
--- grischka