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

            Bug ID: 111519
           Summary: [13/14 Regression] Wrong code at -O3 on
                    x86_64-linux-gnu since r13-455-g1fe04c497d
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shaohua.li at inf dot ethz.ch
                CC: roger at nextmovesoftware dot com
  Target Milestone: ---

gcc at -O3 produced the wrong code.

Bisected to r13-455-g1fe04c497d

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

$ cat a.c
int printf(const char *, ...);
int a, o;
char b, f, i;
long c;
static signed char d;
static char g;
unsigned *h;
signed char *e = &f;
static signed char **j = &e;
static long k[2];
unsigned **l = &h;
short m;
int main(int q, char *r[]) {
  int p = 0;
  if (q == 0)
    p = 1;
  signed char *n = &d;
  *n = 0;
  for (; c;)
    for (; i; i--)
      ;
  g = 0;
  for (; g <= 1; g++) {
    *n = **j;
    k[g] = 0 != &m;
    *e = l && k[0];
  }
  if (p)
    printf(&b);
  for (; o < 4; o++) {
    a = d;
    if (p)
      printf(&b);
  }
  printf("%d\n", a);
}
$
$ gcc -O2 a.c && ./a.out
1
$ gcc -O3 a.c && ./a.out
0
$

Reply via email to