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]
Other format: [Raw text]

Re: Bug in int_fits_type_p


    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.


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