[llvm-bugs] [Bug 50906] New: wrong code at -O2 on x86_64-linux-gnu

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jun 26 18:49:35 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50906

            Bug ID: 50906
           Summary: wrong code at -O2 on x86_64-linux-gnu
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: qrzhang at gatech.edu
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

It appears to be a regression in clang-12.

$ clang-trunk -v
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
043ce4e6bdd376ff460d78446d1a6b94c6e0f18c)
Target: x86_64-unknown-linux-gnu
Thread model: posix


$ clang-trunk abc.c ; ./a.out
0


$ clang-trunk -O2 abc.c ; ./a.out
Floating point exception


$ cat abc.c
int a, b, c;
char d[8];
char e;
int(f)(g, h) { return h > 0 && g < 7 / h || h <= 0 && g && h; }
int main() {
  int i = -1L;
  if (b)
    c = i = 0;
  if (f(i, &d[7] == &e)) {
    volatile int j = 0;
  }
  printf("%X\n", a);
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210627/4209b3fc/attachment.html>


More information about the llvm-bugs mailing list