Hi, I'm experiencing problems when statically linking using particular GCC supplied with XCode 3.2.2: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5659) on Mac OS X 10.6.2. Computations become incorrect.
My application consists of main in C and computational code in Fortran (NETLIB BLAS and slightly modified LAPACK). I'm compiling Fortran code using Intel Fortran Compiler. If I'm linking using the particular build, then results of my computations become completely incorrect. When I'm linking using any other build (5646 from XCode 3.2, or even i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)) everything computes correctly for the exactly same object files. I'm guessing that linker somehow messes constants in my code and this results incorrect computations. I've succeed to see in my big application that constant ONE becomes -ONE with only this linker, however cleaning up for a smaller reproducer I've missed such a constant, but computations results in the reproducer are still incorrect for the build. I've tried different versions of Intel Fortran Compiler (10.1, 11.1, etc), also tried to compile C code with GCC and with Intel C Compiler - all this doesn't affect results. Only GCC build matters, so I assume this is a problem of linker. However map files produced by all mentioned builds of GCC are binary same, so the problem somewhere deeper. I'm attaching object files of reproducer. To link say just: gcc *.o. Resulting a.out will show correct output like: x[0] = {1.000000, 0.000000} x[1] = {1.000000, 0.000000} x[2] = {1.000000, 0.000000} TEST PASSED or report a error like: info = 0 x[0] = {0.856000, -0.608000} - FAIL x[1] = {1.520000, 0.840000} - FAIL x[2] = {0.968000, 1.176000} - FAIL TEST FAILED!!! Please feel free to ask for more details. I would like to help to localize the issue, but just don't know where to look at. Thanks, Alexander -- Summary: problems when linking in XCode 3.2.2 (gcc build 5659) - static constants are messed? Product: gcc Version: 4.2.1 Status: UNCONFIRMED Severity: major Priority: P3 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: alexander dot v dot kobotov at intel dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43834