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

            Bug ID: 40373
           Summary: O2 and O2 lto result differ
           Product: libraries
           Version: 6.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: konstantin.vladimi...@gmail.com
                CC: llvm-bugs@lists.llvm.org

Simple test (after creduce):

---
unsigned b, c, d, e, f;

int main() {
  unsigned h[15] = {3, 12, 2, 10, 6, 11, 7, 9, 8, 14, 3, 5, 1, 4, 0};
  unsigned long i[15] = {0}, j[15] = {0};
  for (; e < 7; e++) {
    for (d = 0; d < 15; d += 3) {
      f = 305 ^ j[d] >> 5;
      j[d] = (104 * j[d] ^ d) - (-j[d] < 8) & 906;
    }
    for (c = 1; c < 15; c++) {
      b = i[h[c]];
      i[h[c]] = 3 - i[h[c]];
    }
  }
  return b;
}
---

clang -O2 test.c -o corr
clang -O2 -flto test.c -o wrong

> wrong
> echo $?
238
> corr
> echo $?
0


> clang -v
clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/i586-suse-linux/2.95.3
Found candidate GCC installation: /usr/lib64/gcc/x86_64-suse-linux/4.3
Selected GCC installation: /usr/lib64/gcc/x86_64-suse-linux/4.3
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to