[LLVMbugs] [Bug 19174] -O1 breaks std::abs
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Mar 25 10:05:37 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19174
Benjamin Kramer <benny.kra at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |benny.kra at gmail.com
Resolution|--- |INVALID
--- Comment #1 from Benjamin Kramer <benny.kra at gmail.com> ---
On linux, rand() without seed returns 1804289383. Multiplying this by 4
overflows a 32 bit integer, which is undefined behavior. The optimizer can use
that fact to simplify code.
To avoid the undefined behavior you can pass -fwrapv to clang.
--
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/20140325/8f34e290/attachment.html>
More information about the llvm-bugs
mailing list