[llvm-bugs] [Bug 25649] New: Wrong constant folding

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 25 20:57:45 PST 2015


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

            Bug ID: 25649
           Summary: Wrong constant folding
           Product: clang
           Version: trunk
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ishiura-compiler at ml.kwansei.ac.jp
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

LLVM + clang-3.8 miscompiles the following code.

$ cat error.c
int a = 0;
long long b = 1LL;
long long c = 3LL;
volatile unsigned int d = 0U;
int f = 0;

int main ( void )
{
    int e = 6 / ((unsigned int)b * (3LL * (3 * c == 9)) << (1 ^ a || d >= 0));

    if ( e != 1 ) { f = e; __builtin_abort(); }

    return 0;
}

$ clang-3.8 error.c -m32 -w -O3

$ ./a.out                                 
zsh: abort      ./a.out

$ clang-3.8 -v                            
clang version 3.8.0 (trunk 254118)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
InstalledDir: /Users/home/clang/bin

-- 
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/20151126/e58f223d/attachment-0001.html>


More information about the llvm-bugs mailing list