[Bug tree-optimization/107172] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 6 18:02:55 GMT 2022


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|wrong code with "-O1        |[13 Regression] wrong code
                   |-ftree-vrp" on              |with "-O1 -ftree-vrp" on
                   |x86_64-linux-gnu            |x86_64-linux-gnu
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-10-06
     Ever confirmed|0                           |1
   Target Milestone|---                         |13.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. Reduced a little bit more:
```
int a, c, d;
int main() {
  long e = 1;
  int f = a = 1;
 L1:
  if (a)
    a = 2;
  int h = e = ~e;
  c = -1;
  if (e >= a)
    goto L2;
  if (-1 > a)
    goto L1;
  if (a)
    f = -1;
 L2:
  d = (-f + d) & h;
  if (d)
    __builtin_abort();
  return 0;
}
```
Note the store for c is important there. I suspect otherwise the load to e is
figured out and does the correct thing.


More information about the Gcc-bugs mailing list