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: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: roger at eyesopen dot com
- Cc: gcc at gcc dot gnu dot org, hainque at act-europe dot fr
- Date: Fri, 24 Dec 04 09:59:22 EST
- Subject: 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.