http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56775
Bug #: 56775 Summary: -flto and -fprofile-generate together result in a link-time internal compiler error (in "add_symbol_to_partition") Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto AssignedTo: unassig...@gcc.gnu.org ReportedBy: mi...@gnu.org If I compile my program with _both_ options "-flto" and "-fprofile-generate", I get a link-time compile error. Using either "-flto" or "-fprofile-generate" _separately_ seems to work correctly. Compiler version is: g++ (Debian 20130316-1) 4.8.0 20130316 (experimental) [trunk revision 196694] I'm not exactly sure how to cut this down...trivial test cases don't seem to have the same problem. A transcript of the final link (the options passed when compiling each object file are similar, minus libraries etc): % make V=1 EXTRA_COMPILE_FLAGS=-fprofile-generate make all-am make[1]: Entering directory `/home/miles/src/snogray/snogray' g++-snapshot -O3 -fomit-frame-pointer -flto -ffast-math -march=native -mfpmath=sse -g -std=c++11 -Wall -Wextra -Winit-self -Wdouble-promotion -pedantic-errors -Wno-long-long -fprofile-generate -fno-finite-math-only -ftrapping-math -fno-associative-math -ffunction-sections -pthread -Wl,--icf=all -o snogray snogray.o recover-image.o libsnoglua.a libsnograw.a liblpeg.a -L/usr//lib -lluajit-5.1 libsnogrdrive.a libsnogloaders.a -l3ds libsnogmat.a libsnogsurf.a libsnoglight.a libsnogrender.a libsnogtex.a libsnogspace.a libsnogscene.a libsnogimagecli.a libsnogimage.a -lpng12 -pthread -lIlmImf -lz -lImath -lHalf -lIex -lIlmThread -ljpeg -lnetpbm libsnogcolor.a libsnogcli.a libsnogutil.a lto1: internal compiler error: in add_symbol_to_partition, at lto/lto-partition.c:284 Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions. lto-wrapper: g++ returned 1 exit status /usr/bin/ld: fatal error: lto-wrapper failed collect2: error: ld returned 1 exit status make[1]: *** [snogray] Error 1 make[1]: Leaving directory `/home/miles/src/snogray/snogray' make: *** [all] Error 2