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

            Bug ID: 94567
           Summary: wrong code at -O2 and -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's a recent regression. Bisection points to g:529ea7d9596b26ba103578eeab


$ gcc-trunk -v
gcc version 10.0.1 20200411 (experimental) [master revision
bb87d5cc77d:75961caccb7:f883c46b4877f637e0fa5025b4d6b5c9040ec566] (GCC)


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

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


$ cat abc.c
volatile int a = 1, b;
short c, d = 4, e = 53736, f = 2, g;
int(h)(int i, int j) { return i && j ? 0 : i + j; }
int main() {
  for (; a; a = 0) {
    unsigned short k = e;
    g = k >> 3;
    if (h(g < (f || c), b))
      d = 0;
  }
  printf("%X\n", d);
}

Reply via email to