[Bug middle-end/84997] Optimize integer operations on floating point constants without -ffast-math

joseph at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Wed Mar 21 22:02:00 GMT 2018


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

--- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Wed, 21 Mar 2018, antoshkka at gmail dot com wrote:

> unsigned test02(unsigned lhs) {
>     return lhs + 2.0; // No signed overflow
> }

If lhs is UINT_MAX or UINT_MAX - 1, the conversion from double to unsigned 
should raise FE_INVALID, i.e. optimizing to integer addition is only valid 
for -fno-trapping-math.


More information about the Gcc-bugs mailing list