[llvm-bugs] [Bug 38641] New: clang miscompiles at -O2 and above on valid code

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 20 09:41:21 PDT 2018


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

            Bug ID: 38641
           Summary: clang miscompiles  at -O2 and above 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

clang-r339936: first working build
clang-r339938: next failing build


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


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

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


$ cat abc.c
int printf(const char *, ...);
int a = 1, b;
static short(c)(short d, int e) { return d < 0 ? d : d >> e; }
int main() {
  char f = a;
  if (c(f, 5))
    printf("%d\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/20180820/387f5273/attachment.html>


More information about the llvm-bugs mailing list