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

            Bug ID: 118963
           Summary: Miscompile at -O2/3
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yunboni at smail dot nju.edu.cn
  Target Milestone: ---

This code times out at -O2/3 and prints 0 at -O0/1/s:

```c
int printf(const char *, ...);
int a = -104, b, c, e;
void g(int h) {
  int f = 0;
  while (!f + a - -104) {
    f = h == 0;
    if (f)
      h = 1;
  }
}
int main() {
  int d = 8;
  for (; e;)
    d = 0;
  c = d;
  g(81 - 81);
  printf("%X\n", b);
}
```

Compiler Explorer: https://godbolt.org/z/q3WajnYPj 

Bisected to
https://github.com/gcc-mirror/gcc/commit/429a7a88438cc80e7c58d9f63d44838089899b12

Reply via email to