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

            Bug ID: 118922
           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 triggers SIGKILL at -O2/3 and prints 0 at -O0/1/s:

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

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

It seems to be a recent regression.

Reply via email to