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

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jan 31 22:39:58 PST 2016


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

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

LLVM + clang 3.9 for x86_64 miscompiles the following code.



% cat test.c
int x =  0;
int y =  -1;

int main (void)
{
  int a = 0x7fffffff + x;
  int b = 0x7fffffff + y;
  int f = (unsigned int) a >= (unsigned int) b;
  if ( f != 1 ) { __builtin_abort(); }
  return 0;
}

% clang-3.9 test.c -O1
% ./a.out             
zsh: abort      ./a.out

% clang-3.9 -v
clang version 3.9.0 (trunk 259289)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

-- 
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/20160201/74a7cb4d/attachment.html>


More information about the llvm-bugs mailing list