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

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Sep 23 15:57:02 PDT 2018


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

            Bug ID: 39057
           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's maybe a dup of bug 39056. Bisect points to different revisions though.

clang-r342369: first working build
clang-r342387: next failing build


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


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


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


$ cat abc.c
int printf(const char *, ...);
volatile int a, d, f;
short b;
char c[6][1];
char e;
void h() {
  int g = 67;
  for (; d <= 1; d++) {
    b ^= 2;
    e = g >= 32 || b > 5 >> g ? b : g;
    c[2][0] = e;
    a;
    g = 0;
    for (; g <= 1; g++)
      ;
  }
}
int main() {
  h();
  for (; f < 6; f++)
    printf("%d\n", c[f][0]);
}

-- 
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/20180923/1d1bd767/attachment.html>


More information about the llvm-bugs mailing list