https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104356

--- Comment #40 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 3 Feb 2022, amacleod at redhat dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104356
> 
> --- Comment #37 from Andrew Macleod <amacleod at redhat dot com> ---
> (In reply to Jakub Jelinek from comment #35)
> > I meant something like:
> >   return Z / X;
> 
> > and there evrp does with -O2 -gnatp optimize away the division.
> > Though that is likely the X / boolean_range_Y case which you've disabled.
> > In any case, I think you want to hear from Andrew/Aldy where exactly does
> > VRP/ranger assume UB on integer division by zero.
> 
> That divide is remove by the simplifier because it determines that X has a
> range of [0,1] and I believe the simplifer chooses to ignore the 0 under
> various circumstances.
> 
> As for ranger, range-ops will return UNDEFINED for the range if x is known to
> be [0,0].  This can be propagated around, and depending on how it ends up 
> being
> used as to what happens with it. 

I think that's OK as outgoing range (on the non-exceptional path - on the
exeptional path the result isn't computed).  That just may not be used
to simplify the stmt producing the range itself of course.

Reply via email to