http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49059
Summary: Linking with -flto fails Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: blocker Priority: P3 Component: lto AssignedTo: unassig...@gcc.gnu.org ReportedBy: petr.ma...@hotmail.com Hello. I've been using CCfits library to write data into FITS files. The code compiles until I turn LTO on, then it fails with: lto1: internal compiler error: in lto_wpa_write_files, at lto/lto.c:1518 lto-wrapper: g++ returned 1 exit status /usr/bin/ld: lto-wrapper failed collect2: ld returned 1 exit status The problem seems to appear only after invoking writeArrays() on CCfits::Column. OS: Ubuntu 11.04 x64 (2.6.38-8-virtual) GCC: 4.6.0 (also present in 'gcc-4.6-20110506') GCC compiled with: --with-arch=native --with-tune=native --enable-threads=posix --with-fpmath=sse --enable-checking --enable-cloog-backend=isl IDE: Eclipse CDT 7.0.2 **** Build of configuration Release for project lto_ccfits_fail **** make all Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper Building file: ../src/Main.cpp Invoking: GCC C++ Compiler g++ -I"/home/petmal/Eclipse_Projects/lto_ccfits_fail/include" -O3 -Wall -c -fmessage-length=0 -flto -save-temps -v -MMD -MP -MF"src/Main.d" -MT"src/Main.d" -o"src/Main.o" "../src/Main.cpp" Target: x86_64-unknown-linux-gnu Configured with: ../gcc-4.6.0/configure --with-arch=native --with-tune=native --enable-threads=posix --with-fpmath=sse --enable-checking --enable-cloog-backend=isl Thread model: posix gcc version 4.6.0 (GCC) COLLECT_GCC_OPTIONS='-I' '/home/petmal/Eclipse_Projects/lto_ccfits_fail/include' '-O3' '-Wall' '-c' '-fmessage-length=0' '-flto' '-save-temps' '-v' '-MMD' '-MP' '-MF' 'src/Main.d' '-MT' 'src/Main.d' '-o' 'src/Main.o' '-shared-libgcc' '-mtune=native' '-march=native' /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/cc1plus -E -quiet -v -I /home/petmal/Eclipse_Projects/lto_ccfits_fail/include -MMD src/Main.d -MF src/Main.d -MP -MT src/Main.d -D_GNU_SOURCE ../src/Main.cpp -march=corei7 -mcx16 -msahf -maes -mpclmul -mpopcnt -msse4.2 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=corei7 -Wall -fmessage-length=0 -flto -O3 -fpch-preprocess -o Main.ii ignoring nonexistent directory "/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /home/petmal/Eclipse_Projects/lto_ccfits_fail/include /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0 /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0/x86_64-unknown-linux-gnu /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0/backward /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/include /usr/local/include /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-I' '/home/petmal/Eclipse_Projects/lto_ccfits_fail/include' '-O3' '-Wall' '-c' '-fmessage-length=0' '-flto' '-save-temps' '-v' '-MMD' '-MP' '-MF' 'src/Main.d' '-MT' 'src/Main.d' '-o' 'src/Main.o' '-shared-libgcc' '-mtune=native' '-march=native' /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/cc1plus -fpreprocessed Main.ii -march=corei7 -mcx16 -msahf -maes -mpclmul -mpopcnt -msse4.2 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=corei7 -quiet -dumpbase Main.cpp -auxbase-strip src/Main.o -O3 -Wall -version -fmessage-length=0 -flto -o Main.s GNU C++ (GCC) version 4.6.0 (x86_64-unknown-linux-gnu) compiled by GNU C version 4.6.0, GMP version 5.0.1, MPFR version 3.0.0, MPC version 0.8.2 warning: GMP header version 5.0.1 differs from library version 4.3.2. GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU C++ (GCC) version 4.6.0 (x86_64-unknown-linux-gnu) compiled by GNU C version 4.6.0, GMP version 5.0.1, MPFR version 3.0.0, MPC version 0.8.2 warning: GMP header version 5.0.1 differs from library version 4.3.2. GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 04a475928a1f5131bc3081e746d72187 COLLECT_GCC_OPTIONS='-I' '/home/petmal/Eclipse_Projects/lto_ccfits_fail/include' '-O3' '-Wall' '-c' '-fmessage-length=0' '-flto' '-save-temps' '-v' '-MMD' '-MP' '-MF' 'src/Main.d' '-MT' 'src/Main.d' '-o' 'src/Main.o' '-shared-libgcc' '-mtune=native' '-march=native' as --64 -o src/Main.o Main.s COMPILER_PATH=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/:/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/:/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/ Finished building: ../src/Main.cpp LIBRARY_PATH=/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-I' '/home/petmal/Eclipse_Projects/lto_ccfits_fail/include' '-O3' '-Wall' '-c' '-fmessage-length=0' '-flto' '-save-temps' '-v' '-MMD' '-MP' '-MF' 'src/Main.d' '-MT' 'src/Main.d' '-o' 'src/Main.o' '-shared-libgcc' '-mtune=native' '-march=native' Building target: lto_ccfits_fail Invoking: GCC C++ Linker g++ -flto -o"lto_ccfits_fail" ./src/Main.o -lCCfits lto1: internal compiler error: in lto_wpa_write_files, at lto/lto.c:1518 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: g++ returned 1 exit status /usr/bin/ld: lto-wrapper failed collect2: ld returned 1 exit status make: *** [lto_ccfits_fail] Error 1