Bug in int_fits_type_p
Olivier Hainque
hainque@adacore.com
Fri Dec 24 16:32:00 GMT 2004
Richard Kenner wrote:
> 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.
Fine with me. This would typically return 0 if the type is wider, right ?
> 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.
Well, I think the code would happy to be able to apply another shortcut
anyway :)
Couldn't we even have something *like*
if (TYPE_PRECISION (type) > TYPE_PRECISION (TREE_TYPE (c)))
return 1;
at the very beginning ? That would allow early replies and possibly wider
coverage for non-constant bounds.
It's a long time since I've touched this function so this might be
overlooking details, but that's an idea.
Olivier
More information about the Gcc
mailing list