This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Ada subtypes and base types
On Mon, 2006-02-27 at 20:26 +0100, Sebastian Pop wrote:
> Jeffrey A Law wrote:
> > On Fri, 2006-02-24 at 19:47 +0100, Sebastian Pop wrote:
> > > Jeffrey A Law wrote:
> > > > Another possibility is to simply not allow conversions between a
> > > > subtype and basetype.
> > >
> > > Such a patch also solves the problem. But I'm not sure to understand
> > > the impact on other codes. Is this kind of conversion between a type
> > > and its basetype specific to Ada?
> > My suspicions appear to be correct. This never triggers except for
> > Ada code and it's relatively common in Ada code. No surprise since
> > I don't think any other front-end abuses TYPE_MAX_VALUE in the way
> > the Ada front-end does. This wouldn't be the first time we've had
> > to hack up something in the generic optimizers to deal with the
> > broken TYPE_MAX_VALUE.
> >
>
> This is good to know, thanks.
>
> I was testing on amd64 this patch that was suggested by Zdenek, it
> passed bootstrap, but is still not finished the test. As you said,
> this is a little bit more computation inefficient, so probably the
> other patch is preferable instead.
I'm testing a patch which implements Zdenek's suggestion --
but in a way that's more computationally efficient than yours.
There's no need to use fold_build2, creating junk nodes in the
process. We just get the bounds and use operand_equal_p to
compare them to the type's min/max values.
Jeff