https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107608
Bug ID: 107608 Summary: [13 Regression] Failure on fold-overflow-1.c Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- With my https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107569#c20 patch I get +FAIL: gcc.dg/fold-overflow-1.c scan-assembler-times 2139095040 2 regression because float foo(void) { return __FLT_MAX__ + __FLT_MAX__; } no longer raises overflow exception. This case is canonicalized to return __FLT_MAX__ * 2.0f; and ranger correctly determines the result is [+Inf, +Inf], but then comes dom2 and happily replaces _1 = 3.4028234663852885981170418348451692544e+38 * 2.0e+0; return _1; with _1 = 3.4028234663852885981170418348451692544e+38 * 2.0e+0; return Inf; (I think this is still correct) and then dce3 removes the _1 = 3.4028234663852885981170418348451692544e+38 * 2.0e+0; statement. That is not correct, because -ftrapping-math is on and this multiplication is supposed to trap. Now, my patch isn't needed, if I do: float bar(void) { return __FLT_MAX__ + (__FLT_MAX__ / 4.0f); } instead, then the same regressed already on vanilla trunk: _1 = 3.4028234663852885981170418348451692544e+38 + 8.507058665963221495292604587112923136e+37; return _1; changes in dom2 to _1 = 3.4028234663852885981170418348451692544e+38 + 8.507058665963221495292604587112923136e+37; return Inf; and in dce3 to just return Inf;