[llvm-bugs] [Bug 49599] Signed integer overflow causes program to skip the epilogue and fall into another function

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 16 00:10:02 PDT 2021


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

Roman Lebedev <lebedev.ri at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID
                 CC|                            |lebedev.ri at gmail.com

--- Comment #1 from Roman Lebedev <lebedev.ri at gmail.com> ---
This is indeed UB, and -fsanitize=undefined will tell you about it:
https://godbolt.org/z/79q6s8
example.cpp:4:29: runtime error: signed integer overflow: 2147483647 + 1 cannot
be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior example.cpp:4:29 in 

You probably want -fwrapv.

-- 
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/20210316/eb465802/attachment.html>


More information about the llvm-bugs mailing list