Bug in int_fits_type_p

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Fri Dec 24 15:15:00 GMT 2004


    Unfortunately, this leads us to believe that an unsigned QImode 255,
    won't fit in an a signed SImode type.  The call to tree_int_cst_msb,
    checks for the most significant bit in C's type, which in this case is
    set but in a mode much narrower than TYPE's mode.

My feeling would be to add a new arg to tree_int_cst_msb, which is the
type with respect to which the MSB should be checked, which seems to
be the intent here anyway.

    The alternate approach would be to add an additional comparison of
    the precisions of both types, something along the lines of:

        && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (c))

    The issue here is that I'm unclear on whether TYPE_PRECISION can
    safely be used like this here for the Ada's variable-range types?

I think it can, be I also think the new arg is the most
straightforward and the most consistent with the intent of the code,
at least as I understand it.



More information about the Gcc mailing list