[Bug c/87311] missing integer overflow detection on negation of the minimum value with -ftrapv or UB sanitizer

amonakov at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Sep 17 10:11:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87311

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #2 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
I think the current behavior is "by design", beside match.pd frontends do some
opportunistic folding on their own, and neither try hard to avoid concealing
overflow that would be caught by ubsan.

I hope it can change though, with mandatory folding (required by language
standards, e.g. constant expressions) and opportunistic folding for
optimization cleanly separated.


More information about the Gcc-bugs mailing list