[llvm-bugs] [Bug 38358] New: clang miscompiles with polly and newgvn at -O2 on valid code

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jul 29 22:48:42 PDT 2018


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

            Bug ID: 38358
           Summary: clang miscompiles with polly and newgvn at -O2 on
                    valid code
           Product: Polly
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Optimizer
          Assignee: polly-dev at googlegroups.com
          Reporter: helloqirun at gmail.com
                CC: llvm-bugs at lists.llvm.org

Affected Polly version (hash tag) is: cdc7133937ea02211ebfeddab9be3ae7ff27229d

It miscompiles with both polly and newgvn enabled.

$ clang-trunk -v
clang version 7.0.0 (trunk 338211)



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

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

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

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

$ cat abc.c
void printf();
int a[56];
int b = 1, e = 3;
static int *c = &b;
char d;
short f;
int main() {
  int g = 0;
  for (; g < 56; g++)
    a[g] = g;
  int h = e;
  e = 2;
  for (; e > -19; e--) {
    f = 1 & h;
    if (f)
      for (; d != 8; --d)
        *c = 0;
  }
  printf("%X\n", b);
}

-- 
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/20180730/a14f1623/attachment-0001.html>


More information about the llvm-bugs mailing list