[Bug tree-optimization/30911] VRP fails to eliminate range checks in Ada code
baldrick at free dot fr
gcc-bugzilla@gcc.gnu.org
Fri Mar 28 22:43:00 GMT 2008
------- Comment #50 from baldrick at free dot fr 2008-03-28 22:42 -------
Subject: Re: VRP fails to eliminate range checks in Ada code
> T' sub;
> T x;
>
> x = sub; (1)
> sub = (T')x; (2)
> x = VIEW_CONVERT_EXPR <T>(sub); (3)
>
> where VRP for the simple copy (1) does not restrict x value range based
> on the T's TYPE_MIN/MAX_VALUE (but it should). For (2) the same is
> true (though the conversion is _not_ truncating for out of bound values,
> so I am not sure if this doesn't break something).
Ada never does (2) unless the value of x is in the range of sub, so this
should be ok for assignments coming straight out of the Ada f-e. It might
be that fold, for example, generates problematic versions of (2) however.
I have no idea if this can happen.
> I don't know if this is really the best setup to optimize Ada range checks,
It seems reasonable. Only using range info for function arguments would
side-step the fold-doesn't-use-base-types problem though.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30911
More information about the Gcc-bugs
mailing list