[llvm-bugs] [Bug 38619] New: clang miscompiles with "-newgvn" at -O2 on valid code

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 17 15:58:53 PDT 2018


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

            Bug ID: 38619
           Summary: clang miscompiles with "-newgvn" at -O2  on valid code
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: helloqirun at gmail.com
                CC: llvm-bugs at lists.llvm.org

It also affects clang-5.0 and clang-6.0.

clang-r312400: first working build
clang-r312401: next failing build


$ clang abc.c ; ./a.out
9
$ clang-4.0 -mllvm -enable-newgvn -O2 abc.c ; ./a.out
9


$ clang-5.0 -mllvm -enable-newgvn -O2 abc.c ; ./a.out
0
$ clang-trunk -mllvm -enable-newgvn -O2 abc.c ; ./a.out
0


$ clang-trunk -v
clang version 8.0.0 (trunk 340070)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin


$ cat abc.c
void printf();
int a;
short b, c, d, f;
char e;
int g() {
  d = 0;
  for (;; ++d) {
    b = f = d * a;
    e = f % 0x95216DC9;
    c |= e;
    if (d)
      return 3;
    for (; a < 8; a = 9)
      ;
  }
}
int main() {
  g();
  printf("%d\n", e);
}

-- 
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/20180817/ca9d3ace/attachment.html>


More information about the llvm-bugs mailing list