As noted in PR42074, linking with the math library on darwin10 allows overflow to occur during complex division. It was originally reported as a failure in testcase gcc.dg/torture/builtin-math-7.c at all optimization levels. However as described in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42074#c10 the error is related to using -lm on the reduced testcase below. Without -lm it passes, with -lm a failure occurs. As such, it isn't necessarily a bug in GCC, however this PR will help track if there is a possible workaround.
int main(void) { volatile _Complex double val = (__DBL_MAX__ * 0.5 + __DBL_MAX__ * 0.5i); val /= (__DBL_MAX__ * 0.25 + __DBL_MAX__ * 0.25i); __builtin_printf ("%g %g\n", __real (val), __imag (val)); if (val != 2) __builtin_abort(); return 0; } -- Summary: complex division failure on darwin10 with -lm Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ghazi at gcc dot gnu dot org GCC target triplet: *-*-darwin10 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42333