When trying to compile and link the attached file bug_lto.ii with LTO the link process dies with the message "lto1: internal compiler error: Segmentation fault"
Everything is fine if I do not use -flto for linking the shared library. Command line that triggers the bug: $ /home/martinkr/Programme/compilers/bin/g++ -flto -fPIC -o bug_lto.o -c bug_lto.ii $ /home/martinkr/Programme/compilers/bin/g++ -flto -fPIC -shared -o libdummy.so bug_lto.o lto1: internal compiler error: Segmentation fault lto-wrapper: /home/martinkr/Programme/compilers/bin/g++ returned 1 exit status collect2: lto-wrapper returned 1 exit status $ /home/martinkr/Programme/compilers/bin/g++ -v Using built-in specs. COLLECT_GCC=/home/martinkr/Programme/compilers/bin/g++ COLLECT_LTO_WRAPPER=/home/martinkr/Programme/compilers/libexec/gcc/x86_64-linux-gnu/4.5.1/lto-wrapper Target: x86_64-linux-gnu Configured with: ../configure --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/home/martinkr/Programme/compilers --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --without-included-gettext --enable-threads=posix --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-cpu=core2 Thread model: posix gcc version 4.5.1 20100513 (prerelease) (GCC) The error is also present in the 4.5.0 release. -- Summary: lto1: internal compiler error: Segmentation fault Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: martin dot kronbichler at it dot uu dot se GCC build triplet: x86_64-linux-gnu GCC host triplet: x86_64-linux-gnu GCC target triplet: x86_64-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44196