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

            Bug ID: 117723
           Summary: Miscompile with -O1 and -O0/2/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: ---

When I compiled this code with -O1, its output was 0. With -O0/2/3, it was 1:

```c
int printf(char *, ...);
int a, b = 3;
int c(int d, int e) {
  if (d & 1) {
    if (e || (d & 2))
      return 1;
    else
      return 0;
  }
  return 0;
}
int main() {
  a = c(b - 98, b);
  printf("%d\n", a);
}
```

Compiler Explorer: https://godbolt.org/z/44T1cxGoz

It seems to be a recent regression.

Reply via email to