[Bug middle-end/82223] Incorrect optimization for lossy round trips of arithmetic types

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Sep 15 19:58:00 GMT 2017


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

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
(float)INT_MAX gets rounded to 2^31. When you try to convert it to int, it
doesn't fit, so the compiler is at liberty to return INT_MAX if it likes.
clang's -fsanitize=undefined does complain on your code (not gcc's though).


More information about the Gcc-bugs mailing list