Le mercredi 11 août 2010 16:52:25, Thomas Preud'homme a écrit :
> Hi all,
> 
[SNIP]

Ok, I might have found. mathcalls.h is provided on Debian by libc6-dev. I made 
a diff between the version used in the last build and the current version and 
found there has been some changes around the last inclusion of 
bits/mathcalls.h (the one which declares each function with long double 
operand). I looked at the code in parse_btype function in tccgen.c

Here is the relevant code:

    t = 0;
    while(1) {
        switch(tok) {

 (some "case")

        case TOK_LONG:
            next();
            if ((t & VT_BTYPE) == VT_DOUBLE) {
                t = (t & ~VT_BTYPE) | VT_LDOUBLE;
            } else if ((t & VT_BTYPE) == VT_LONG) {
                t = (t & ~VT_BTYPE) | VT_LLONG;
            } else {
                u = VT_LONG;
                goto basic_type1;
            }
            break;

The test in TOK_LONG seems useless as t can't be different from 0 although I 
missed some hidden define which touch the variable 't'

Thus, program branch to basic_type1:

        basic_type1:
            if ((t & VT_BTYPE) != 0)
                error("too many basic types");
            t |= u;
            typespec_found = 1;
            break;

t is zero so the test is ok, the type t become u (VT_LONG) and the type is 
supposed to be found. All this happen when parsing the acos function (first 
function in mathcalls.h). This function first call parse_btype, then a few 
lines later it calls type_decl which parses "double" in that case. In 
type_decl, the token is tested and as it is not an identifier, it calls 
expect("identifiers"). The relevant code in type_decl is:

        /* type identifier */
        if (tok >= TOK_IDENT && (td & TYPE_DIRECT)) {
            *v = tok;
            next();
        } else {
            if (!(td & TYPE_ABSTRACT))
                expect("identifier");
            *v = 0;
        }

So to conclude, it seems a bug exist in the way parse_btype look for long long 
and long double. If not, please correct me quickly as I'll fix this this WE or 
earlier.

Best regards,

Thomas

Attachment: signature.asc
Description: This is a digitally signed message part.

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

Reply via email to