------- Comment #2 from ghazi at gcc dot gnu dot org 2009-12-08 16:46 ------- (In reply to comment #1) > > As such, it isn't necessarily a bug in GCC, however > > this PR will help track if there is a possible workaround. > As far as I understand the use of the gcc compilers on darwin, I do not see > when I should use -lm. > So the simplest "workaround" could be to not use -lm in the testsuite at least > for intel-darwin10. > If someone tells me how to do that I can do the testing.
I don't think that's the right approach, that would only mask the bug in the testsuite but leave it in userland. IMHO, the first thing we need to understand is *why* the math library is the trigger. In the assembler output from Jack in PR42074, the only function calls are to abort and __divdc3 which is a libgcc2 provided function that performs the complex division. I don't see why -lm would override either one, let alone a GCC internal one. You may be able to check via "nm" if libm defines it. Oh wait, try running ldd (or the darwin equivalent) on the shared math library. See if it (or any of its dependencies) link in a another darwin copy of libgcc2 from the system compiler. Maybe there's an old definition of __divdc3 in there that is overriding the one from gcc-4.5 and yields a bogus result. Also check if linking staticly solves the problem. Thanks. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42333