http://llvm.org/bugs/show_bug.cgi?id=16069
Bug ID: 16069
Summary: Miscompilation of functiona call at -Os and above
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
The following code is miscompiled by clang trunk on x86_64-linux-gnu at -Os and
above, resulting in a SIGFPE when foo() is called.
$ clang-trunk -v
clang version 3.4 (trunk 182209)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ clang-trunk -O1 test.c
$ ./a.out
$ clang-trunk -Os test.c
$ ./a.out
Floating point exception (core dumped)
$
------------
int *a, b, *c, d;
int foo (short p, int q)
{
return q == 0 || (p != 0 && q == 1) ? p : 1 % q;
}
int main ()
{
c = &d;
*c = ((int)&a) == 0;
b = foo (0, d);
return 0;
}
--
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