I saw that with GCC4.5, my software-only 3D renderer got a sizeable speed boost when using -flto (during compilation) and -flto -fwhole-program (during linking). I saw this working, successfully, with GCC4.5.0.
I then tried the same thing with 4.5.1 - and got an internal compiler error. The crash doesn't happen when compiling, it happens at the final - link - stage, so there's no preprocessed input to provide... I can only hope that you will be able to reproduce it on your environment. The output error message from the linking stage: lto1: internal compiler error: in gimple_register_type, at gimple.c:3820 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: /usr/local/bin/g++45 returned 1 exit status collect2: lto-wrapper returned 1 exit status *** Error code 1 The source code that triggers the bug is here: http://users.softlab.ntua.gr/~ttsiod/renderer-2.x.latest.tar.bz2 Just use a simple "./configure && make" - it should be enough to trigger the error. The GCC I used: $ g++45 -v Using built-in specs. COLLECT_GCC=g++45 COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc45/gcc/x86_64-portbld-freebsd8.0/4.5.1/lto-wrapper Target: x86_64-portbld-freebsd8.0 Configured with: ./../gcc-4.5-20100520/configure --enable-lto=yes --with-libelf=/usr/local --disable-nls --libdir=/usr/local/lib/gcc45 --libexecdir=/usr/local/libexec/gcc45 --program-suffix=45 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc45/include/c++/ --with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local --with-system-zlib --disable-rpath --enable-libgcj --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc45 --build=x86_64-portbld-freebsd8.0 Thread model: posix gcc version 4.5.1 20100520 (prerelease) (GCC) My system: $ uname -a FreeBSD freebsd.gizi.gr 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov 21 15:02:08 UTC 2009 r...@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 The compilation options generated by configure and used during compilation: g++45 -DHAVE_CONFIG_H -I. -I/usr/local/include/SDL -I/usr/local/include -D_GNU_SOURCE=1 -D_REENTRANT -I./../lib3ds-1.3.0/ -fopenmp -O3 -g -Wall -Wextra -fomit-frame-pointer -ffast-math -funsafe-math-optimizations -mtune=native -flto -msse -mrecip -mfpmath=sse -msse2 -mssse3 -DNDEBUG -MT renderer-Base3d.o -MD -MP -MF .deps/renderer-Base3d.Tpo -c -o renderer-Base3d.o `test -f 'Base3d.cc' || echo './'`Base3d.cc Compilation doesn't trigger the error, linking does, and these are the linking params: g++45 -O3 -g -Wall -Wextra -fomit-frame-pointer -ffast-math -funsafe-math-optimizations -mtune=native -flto -msse -mrecip -mfpmath=sse -msse2 -mssse3 -DNDEBUG -o renderer renderer-renderer.o renderer-Algebra.o renderer-Camera.o renderer-Keyboard.o renderer-Light.o renderer-Object3D.o renderer-Scene.o renderer-Screen.o renderer-Base3d.o -fwhole-program -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lSDL -pthread -fopenmp ../lib3ds-1.3.0/lib3ds/.libs/lib3ds.a -lstdc++ Anything else I might help with, don't hesitate to ask. -- Summary: When using -flto and -fwhole-program the compiler/linker crash Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: blocker Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ttsiodras at gmail dot com GCC build triplet: x86_64-unknown-freebsd8.0 GCC host triplet: x86_64-unknown-freebsd8.0 GCC target triplet: x86_64-unknown-freebsd8.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44256