http://llvm.org/bugs/show_bug.cgi?id=16642
Bug ID: 16642
Summary: Optimization eliminates an overflow check.
Product: clang
Version: 3.3
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
The following simple function
long long f(long long x, long long y) {
long long r;
long long err = 0;
r = x * y;
err = y != 0 && r / y != x;
return err ? 0 : r;
}
clang -c -O1 -S bla.c
compiles to just
f: # @f
.cfi_startproc
# BB#0:
imulq %rsi, %rdi
movq %rdi, %rax
ret
.Ltmp0:
.size f, .Ltmp0-f
.cfi_endproc
which eliminates the attempted overflow checking, and therefore returns results
other than expected when x * y overflows.
--
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