https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953
--- Comment #25 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- The option to use to detect this is -fsanitize=float-cast-overflow (note: I haven't tested if it detects this particular case). As per the manual: "Unlike other similar options, @option{-fsanitize=float-cast-overflow} is not enabled by @option{-fsanitize=undefined}.". (Annex F makes the result an unspecified value with "invalid" raised, instead of being undefined behavior, which justifies not including it in -fsanitize=undefined by default. That means that each time such a conversion occurs in the abstract machine, some value representable in the result type must be produced; it can't be a "wobbly" value where different uses of the result of the conversion, that was only executed once in the abstract machine, act like different values or like values not of the result type. If such a conversion does produce a wobbly value, that's a bug; see bug 93806 comments 27 to 29 for examples of such a bug.)