https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79341
--- Comment #43 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Ah, so, if I build with -O0, I always get the expected errors. If I build with -O2 -mcpu=z9-109, I also get them, but with -O2 -mcpu=z10 or -O2 -mcpu=zEC12 I don't. Does _Decimal32 on s390{,x} behave similarly to float/double on i387, that computations and comparisons can be performed in bigger precision than their types? --- gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-8.c.jj 2015-10-29 09:14:30.000000000 +0100 +++ gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-8.c 2017-02-10 18:09:47.767251774 +0100 @@ -8,7 +8,7 @@ #define TEST(type1, type2) \ if (type1##_MIN) \ { \ - type2 min = type1##_MIN; \ + volatile type2 min = type1##_MIN; \ type2 add = -1.0; \ while (1) \ { \ @@ -28,7 +28,7 @@ volatile type1 tem3 = cvt_##type1##_##type2 (-1.0f); \ } \ { \ - type2 max = type1##_MAX; \ + volatile type2 max = type1##_MAX; \ type2 add = 1.0; \ while (1) \ { \ seems to be a workaround, the test primarily cares about the actual conversions, not how those values are reached, so it isn't against the intent of the test.