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

--- Comment #3 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> Confirmed.
> 
> You can hit the bug in GCC 7/8 by `s/c = 1/c = -1/`.

I don't see it with 7.4.1 20191114 when bisecting with either of the files.

/tmp/a.c:
```
int printf(const char *, ...);
int a, c;
long b;
short d;
long e(long f, long h, long i) {
  for (long g = f; g <= h; g += i)
    b += g;
  return b;
}
int main() {
  c = 1;
  for (; c >= 0; c--)
    ;
  for (; e(d + 40, d + 76, c + 51) < 4;)
    ;
  printf("%X\n", a);
}
``

/tmp/a2.c:
```
int printf(const char *, ...);
int a, c;
long b;
short d;
long e(long f, long h, long i) {
  for (long g = f; g <= h; g += i)
    b += g;
  return b;
}
int main() {
  c = -1;
  for (; c >= 0; c--)
    ;
  for (; e(d + 40, d + 76, c + 51) < 4;)
    ;
  printf("%X\n", a);
}
```

```
$ /tmp/gcc-pfx/bin/gcc /tmp/a.c -o /tmp/a -O2 -fwrapv && /tmp/a
0
$ /tmp/gcc-pfx/bin/gcc /tmp/a2.c -o /tmp/a -O2 -fwrapv && /tmp/a
0
```

What am I missing?

Reply via email to