This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Long long & templates (was: Re: Loki's tricky templates)


Hi all, hi Phil (I'm back to you after a good amount of sleep)

Phil Edwards wrote:

[snip]

>     /* Write out an integeral CST in decimal.  */
>     static inline void
>     write_integer_cst (cst)
>          tree cst;
>     {
>       if (tree_int_cst_sgn (cst) >= 0)
>         {
>           if (TREE_INT_CST_HIGH (cst) != 0)
>             sorry ("mangling very large integers");
>           write_unsigned_number (TREE_INT_CST_LOW (cst));
>         }
>       else
>         write_signed_number (tree_low_cst (cst, 0));
>     }
>
> I'm not familiar with the mangling code, so I don't know how feasible it
> would be to "simply" extend write_number to handle full INTEGER_CST's; right
> now it takes a single HOST_WIDE_INT instead of the (I think) needed two.

Indeed, when I wrote something along the lines "for you developers, should be easy to fix
the front-end to emit a proper diagnostic", I had had a look at *exactly* this part of the
code in mangle.c !!! (basically, I arrived at it by simply grepping the sources for
"mangling very large integers")

I'm definitely *not* familiar with the mangling code but something is *very* suspect with
that section: if cst is negative, no check at all is performed on it's size!

Anyway, that portion of code, overall, is quite easy to follow!?!
Perhaps we could even venture to prepare a patch, my stronger concern being that at the
moment I don't know if there are any macro and functions which could be easily exploited to
this end. Perhaps a TREE_INT_CST_HIGH which is able to check numbers large in modulus, both
positive and negative???

A couple of puntualizations on my part about the issue at large: yesterday I did *really*
believe that restricting the size of mangl-able numbers had been probably an (obscure)
design choice (my question was not a rethoric one!): I had reasoned that perhaps in this way
the mangler is faster, or something else. Also, whereas Gcc is moving to support C99 (thanks
Benjamin for the explanations) on the other hand, *templates* are definitely not C89 neither
C99. So, perhaps, it would be consistent not to allow long long in templates... On the other
hand it my seems strange, to say the least, that long long numbers are supported everywhere
else *except* in templates...


P.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]