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

            Bug ID: 111233
           Summary: Wrong code at -O3 on x86_64-linux-gnu since
                    r14-2852-gf5fb9ff2396
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shaohua.li at inf dot ethz.ch
                CC: hubicka at gcc dot gnu.org, jh at suse dot cz
  Target Milestone: ---

gcc at -O3 produces the wrong code.

Bisected to r14-2852-gf5fb9ff2396

Compiler explorer: https://godbolt.org/z/vrEMjKr9f

$ cat a.c
int printf(const char *, ...);
int a, c, f;
char b, g;
int *d = &c;
long e;
int main() {
  for (; e != 25; e++) {
    f = -17;
    for (; f <= 0; f = f + 7) {
      g = f ? 0 : b;
      a = *d;
    }
  }
  printf("%d\n", a);g
}
$
$ gcc -O2 a.c && ./a.out
0
$ gcc -O3 a.c
$ ./a.out
(Timeout)
$

Reply via email to