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


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

 


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