http://llvm.org/bugs/show_bug.cgi?id=15940
Bug ID: 15940
Summary: Wrong constant folding
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Backend: X86
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
LLVM (git) + clang (3.4) for x86_64 miscompiles the following code.
$ cat error.c
int x = 1;
int main (void)
{
if ( 5 % ( 3 * x ) + 2 != 4 ) __builtin_abort();
return 0;
}
$ clang error.c -O1
$ ./a.out
Aborted (core dumped)
The following code with variable x replaced by "1" is
correctly compiled.
$ cat noerror.c
int main (void)
{
if ( 5 % ( 3 * 1 ) + 2 != 4 ) __builtin_abort();
return 0;
}
$ clang noerror.c -O1
$ ./a.out
0
$ clang -v
clang version 3.4 (http://llvm.org/git/clang.git
3923d6a87fe7b2c91cc4a7dbd90c4ec7e2316bcd)
(http://llvm.org/git/llvm.git
363160a6be82df343fa60aa09d9d8f8f44605529)
Target: x86_64-unknown-linux-gnu
Thread model: posix
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs