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

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to