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

            Bug ID: 93767
           Summary: wrong code at -O3 on x86_64-linux-gnu
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qrzhang at gatech dot edu
  Target Milestone: ---

It appears to be a regression in 8.X. Gcc-7.4 works fine.

Bisection points to:  g:a57776a11369621f9e9e8a8a3db6cb406c8bf27b


$ gcc-trunk -v
gcc version 10.0.1 20200216 (experimental) [master revision
93b8cfce27a:6bc9d585053:9a3d019a74d8d49fb6e6d75a00bd79fdb936a2e1] (GCC)


$ gcc-trunk abc.c ; ./a.out
1


$ gcc-trunk -O3 abc.c ; ./a.out
0


$ gcc-8 -O3 abc.c ; ./a.out
0

$ cat abc.c
int printf(const char *, ...);
int a[10];
short b;
int main() {
  b = 6;
  for (; b >= 3; b--) {
    a[b] = 0 <= 0;
    a[b + 2] = a[3];
  }
  printf("%d\n", a[5]);
}

Reply via email to