https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91709
--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- See the C17 standard, Annex F.4 "Floating to integer conversion": "Otherwise, if the floating value is infinite or NaN or if the integral part of the floating value exceeds the range of the integer type, then the "invalid" floating-point exception is raised and the resulting value is unspecified.". (Together with the response to DR#442: "WG14 treats normative annexes such as Annex F as if they were linear extensions of the standard itself. When Annex F is requested via definition of __STDC_IEC_559__ then 6.5#5 is superseded and floating point exceptions become well defined.".) Unspecified value, as opposed to undefined behavior, means this transformation is only valid with -fno-trapping-math.