------- Comment #3 from dominiq at lps dot ens dot fr 2009-12-08 18:31 ------- (In reply to comment #2) > I don't think that's the right approach, that would only mask the bug in the > testsuite but leave it in userland. ...
You are right, but from what follows I think the problem comes from the way the additional libs are passed to collect2. First, without -lm, gcc45 uses the following collect2: /opt/gcc/gcc4.5w/libexec/gcc/x86_64-apple-darwin10/4.5.0/collect2 -dynamic -arch x86_64 -macosx_version_min 10.6.2 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/opt/gcc/gcc4.5w/lib/gcc/x86_64-apple-darwin10/4.5.0 -L/opt/gcc/gcc4.5w/lib/gcc/x86_64-apple-darwin10/4.5.0/../../.. pr42074.o -lgcc_s.10.5 -lgcc_ext.10.5 -lgcc -no_compact_unwind -lSystem and the test succeed. Second, if I add -lm, I get /opt/gcc/gcc4.5w/libexec/gcc/x86_64-apple-darwin10/4.5.0/collect2 -dynamic -arch x86_64 -macosx_version_min 10.6.2 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/opt/gcc/gcc4.5w/lib/gcc/x86_64-apple-darwin10/4.5.0 -L/opt/gcc/gcc4.5w/lib/gcc/x86_64-apple-darwin10/4.5.0/../../.. pr42074.o -lm -lgcc_s.10.5 -lgcc_ext.10.5 -lgcc -no_compact_unwind -lSystem and the text fails. Note that -lm is passed before "-lgcc_s.10.5 -lgcc_ext.10.5 -lgcc -no_compact_unwind -lSystem". Third, libm.dylib is a symlink to libSystem.dylib lrwxr-xr-x 1 root wheel 15 Aug 14 22:47 /usr/lib/libm.dylib -> libSystem.dylib* so -lm seems redundant. Fourth, I see [macbook] f90/bug% otool -L /usr/lib/libSystem.dylib /usr/lib/libSystem.dylib: /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.0) /usr/lib/system/libmathCommon.A.dylib (compatibility version 1.0.0, current version 315.0.0) [macbook] f90/bug% nm /usr/lib/libSystem.B.dylib | grep divdc3 0019fa1e S $ld$hide$os10.4$___divdc3 0019fa1f S $ld$hide$os10.5$___divdc3 001640d0 T ___divdc3 Five, If I don't use -lm, but place -lSystem before "-lgcc_s.10.5 -lgcc_ext.10.5 -lgcc -no_compact_unwind" as in [macbook] f90/bug% /opt/gcc/gcc4.5w/libexec/gcc/x86_64-apple-darwin10/4.5.0/collect2 -dynamic -arch x86_64 -macosx_version_min 10.6.2 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/opt/gcc/gcc4.5w/lib/gcc/x86_64-apple-darwin10/4.5.0 -L/opt/gcc/gcc4.5w/lib/gcc/x86_64-apple-darwin10/4.5.0/../../.. pr42074.o -lSystem -lgcc_s.10.5 -lgcc_ext.10.5 -lgcc -no_compact_unwind the test abort. My uneducated conclusions are first, that -lm is redundant with -lSystem and probably should never be used (unless you ask for trouble), second, ___divdc3 uses a lazy complex division (a bug to be reported upstream!-), third, the way additional libs are passed to collect2 is probably right if one wants to overwrite functions in the default libs. I have now access to intel-darwin9 and I'll see what going on for it after dinner time. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42333