http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57994
Bug ID: 57994 Summary: Constant folding of infinity Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org double f(){ return __builtin_exp(-__builtin_huge_val()); } As noticed in PR57974, we fail to fold this to a constant. Indeed, in do_mpfr_arg1, the relevant code is protected by if (real_isfinite (ra) ... mpfr handles infinite values, so it should be doable, at least with -ffast-math (there might be some errno issues with default options).