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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-07-05
           Keywords|                            |wrong-code
            Version|unknown                     |12.0
            Summary|wrong code at -Os and above |wrong code at -O2 and above
                   |on x86_64-linux-gnu         |
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---

Also -fwrapv works around the issue, -fsanitize=undefined does not output any
undefined behavior either.

EVRP has the first difference.

Before EVRP we had:
  a.0_1 = aD.1942; // -1u
  _2 = ~a.0_1; //0u
  c_9 = (intD.6) _2; //0
  _3 = c_9 + -10; // -10
  d_10 = (unsigned intD.9) _3; //-10u
  if (_2 < d_10) // 0u < -10u which is true

But EVRP:
Predicate evaluates to: DON'T KNOW
 folding with relation  > 

Predicate evaluates to: 0
EVRP:hybrid: Second query simplifed stmt
Folded into: if (0 != 0)

---- CUT ----
Looks like this value relation is being used but rather it should have just
converted to != rather < with the casts happening:
 Registering value_relation (_3 < c_9) (bb2) at _3 = c_9 + -10;

Reply via email to