https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89437
Bug ID: 89437 Summary: [9 regression] incorrect result for sinl (atanl (x)) Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: wilco at gcc dot gnu.org Target Milestone: --- A recently added optimization uses an inline expansion for sinl (atanl (x)). As it involves computing sqrtl (x * x + 1) which can overflow for large x, there is a check to ensure x is within the right range. The check emitted is x <= sqrtl (LDBL_MAX). It's not clear whether that's a bug in mpfr or build_sinatan_real, however it is safe to change the test to x < sqrtl (LDBL_MAX). In principle the comparison should use a much smaller constant given that x * x + 1 equals x * x for x > 2^113 for any long double format, so we know sinl (atanl (x)) must be 1.0 for all larger values. Testcase is gcc.dg/sinatan-1.c after using nextafterl instead of incorrect nextafter for the long double. I'll post a patch to fix this.