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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu.org
     Ever confirmed|0                           |1
             Blocks|                            |85316
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |missed-optimization
          Component|middle-end                  |tree-optimization
   Last reconfirmed|                            |2021-01-05

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
So VRP computes

Visiting conditional with predicate: if (len_13 > j_14)

With known ranges
        len_13: size_t [i_6(D) + 1, +INF]  EQUIVALENCES: { len_7(D) } (1
elements)      j_14: long unsigned int [0, i_6(D)]  EQUIVALENCES: { j_8(D) } (1
elements)

Predicate evaluates to: DON'T KNOW

where I guess the issue is that we assume i_6(D) + 1 may overflow to zero
(the [i_6(D) + 1, +INF] range is computed from len_7(D) > i_6(D) where
we _know_ that i_6(D) + 1 cannot overflow.

The representation of symbolic relations as ranges makes things awkward
(we for sure cannot generally assume i_6(D) + 1 cannot overflow).  We
could possibly mark ranges as originally derived to not have overflowing
bound computations somehow (maybe with a flag in on value-range).

symbolic range VRP is most important for Ada so CCing Eric


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85316
[Bug 85316] [meta-bug] VRP range propagation missed cases

Reply via email to