[Bug c++/71753] Clamp function does not work with O3 optimization

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 4 10:05:00 GMT 2016


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

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
-fsanitize=undefined
a.c:11:21: runtime error: signed integer overflow: 260 + 2147483392 cannot be
represented in type 'int'

You need to use an unsigned type for this type of computation.


More information about the Gcc-bugs mailing list