[llvm-bugs] [Bug 35057] Clang "-O2" option cause if statement check error

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 24 11:56:09 PDT 2017


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

Eli Friedman <efriedma at codeaurora.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID
                 CC|                            |efriedma at codeaurora.org

--- Comment #1 from Eli Friedman <efriedma at codeaurora.org> ---
Tried compiling your testcase with -fsanitize=undefined; ubsan says:

<stdin>:109:22: runtime error: signed integer overflow: 2147483647 -
-2147483648 cannot be represented in type 'int'

We make no guarantees about the behavior of code with undefined behavior.  See
also http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html . 
 (For signed integer overflow in particular, you can use the flag -fwrapv to
make it have defined behavior.)

-- 
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/20171024/f3ddd514/attachment-0001.html>


More information about the llvm-bugs mailing list