This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Bug in int_fits_type_p
- From: Olivier Hainque <hainque at adacore dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: roger at eyesopen dot com, gcc at gcc dot gnu dot org, hainque at adacore dot com
- Date: Fri, 24 Dec 2004 16:15:08 +0100
- Subject: Re: Bug in int_fits_type_p
- References: <10412241459.AB14855@vlsi1.ultra.nyu.edu>
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