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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to