[llvm-bugs] [Bug 40496] a pass error, this pass never consider data overflow

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 28 09:22:12 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40496

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
This example has undefined behaviour due to signed overflow. In a correct
program, it is not possible for adding an unsigned char to a positive integer
to produce a negative integer, so the optimisation is correct.

If you want to write nonstandard code that assumes that signed overflow wraps
around, you can use -fwrapv to define this otherwise-undefined behaviour as
wrapping.

-- 
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/20190128/d59d87b9/attachment.html>


More information about the llvm-bugs mailing list