[Bug c/87311] missing integer overflow detection on negation of the minimum value with -ftrapv or UB sanitizer
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 14 20:54:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87311
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
/* -A - 1 -> ~A */
(simplify
(minus (convert? (negate @0)) integer_each_onep)
(if (!TYPE_OVERFLOW_TRAPS (type)
&& tree_nop_conversion_p (type, TREE_TYPE (@0)))
(bit_not (convert @0))))
I would have expected at least -ftrapv to disable this transformation, but I
see "i = ~i" in the .original dump...
More information about the Gcc-bugs
mailing list