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

--- Comment #13 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 17 Oct 2019, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92131
> 
> --- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> (In reply to Eric Botcazou from comment #11)
> > > From what I can see, the weird + 0x7ffffffffffffffe is created when
> > > extract_range_from_plus_minus_expr is called with PLUS_EXPR and VARYING 
> > > and
> > > long int [-INF, e.7_8 + -1] ranges.
> > >       /* Build the symbolic bounds if needed.  */
> > >       adjust_symbolic_bound (min, code, expr_type,
> > >                              sym_min_op0, sym_min_op1,
> > >                              neg_min_op0, neg_min_op1);
> > >       adjust_symbolic_bound (max, code, expr_type,
> > >                              sym_max_op0, sym_max_op1,
> > >                              neg_max_op0, neg_max_op1);
> > > in there.  max_op0 is 9223372036854775807 (maximum of VARYING), and 
> > > max_op1
> > > is -1 (which is not the upper bound, just an offset against the symbolic).
> > > combine_bound adds this into wmax, so 9223372036854775807 + -1 gives
> > > 0x7ffffffffffffffe and that is what is used.
> > 
> > This looks like the bug, i.e. combine_bound shouldn't be called on VARYING.
> 
> Perhaps, but it would still be called for
> long int [-9223372036854775805, +INF] + long int [-INF, e.7_8 + -1], for which
> it would still end up with long int [-INF, e.7_8 + 9223372036854775806].

We cannot really add range bounds to symbolics because those bounds
are not added in the IL and thus those adds are prone to overflowing.

We can only do

 _1 = _2 + 1;


with _2 = [ -1, _3 + 4]

derive _1 = [ 0, _3 + 5]

but not for

 _1 = _2 + _4;

with _4 = [ 0, 1 ]

derive _1 = [ -1, _3 + 5]

Richard.

Reply via email to