https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79341
--- Comment #40 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Dominik Vogt from comment #38) > (And if it does generate messages, does it take the if or the else bodies? > For me it's the if-bodies.) /home/jakub/gcc/obj/gcc/xgcc -B/home/jakub/gcc/obj/gcc/ fco.c -B/home/jakub/gcc/obj/s390x-ibm-linux-gnu/./libsanitizer/ -B/home/jakub/gcc/obj/s390x-ibm-linux-gnu/32/libsanitizer/ubsan/ -L/home/jakub/gcc/obj/s390x-ibm-linux-gnu/32/libsanitizer/ubsan/.libs -fno-diagnostics-show-caret -fdiagnostics-color=never -O0 -Wno-psabi -fsanitize=float-cast-overflow -fsanitize-recover=float-cast-overflow -lm -o ./fco.exe -g -m31 [jakub@devel4 testsuite]$ LD_LIBRARY_PATH=/home/jakub/gcc/obj/s390x-ibm-linux-gnu/32/libsanitizer/ubsan/.libs:/home/jakub/gcc/obj/s390x-ibm-linux-gnu/32/libgcc/32/ ./fco.exe fco.c:4:3: runtime error: value <unknown> is outside the range of representable values of type 'long int' fco.c:9:3: runtime error: value <unknown> is outside the range of representable values of type 'long long int' What do you mean by if bodies? (-0x7fffffffffffffffL - 1L) is non-zero, so obviously the else bodies aren't reached. The first loop loops until add is -1.000000E+12, at which point for the first time tem is -9.223373E+18 and thus different from -9.223372E+18, and -9.223373E+18 should not be representable in signed long. Do you perhaps use HW dfp rather than software emulation? In *.optimized dump I see: x.0_8 = x_7(D); _1 = x.0_8 u<= -9.223373E+18; _2 = x.0_8 u>= 9.223373E+18; _3 = _1 | _2; if (_3 != 0) goto <bb 3>; [0.00%] else goto <bb 4>; [0.00%] <bb 3> [0.00%]: _4 = VIEW_CONVERT_EXPR<unsigned int>(x.0_8); _5 = (unsigned long) _4; __builtin___ubsan_handle_float_cast_overflow (&*.Lubsan_data0, _5); <bb 4> [0.00%]: _11 = (long int) x.0_8; <L3> [0.00%]: return _11; which looks also correct to me.