http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49922
Summary: I try to build libgmp using PGO and lto, but the test will result in "internal compiler error" Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile AssignedTo: unassig...@gcc.gnu.org ReportedBy: xunxun1...@gmail.com Host: *-*-mingw* Target: *-*-mingw* Build: *-*-mingw* My gcc4.6.1 configure with : ./configure --prefix=/mingw --host=i686-pc-mingw32 --build=i686-pc-mingw32 --target=i686-pc-mingw32 \ --with-lto-plugin --with-host-libstdcxx=-lstdc++ --disable-bootstrap --disable-werror --with-arch=i686 --with-tune=generic \ --enable-languages=c,c++,fortran --enable-libgomp --enable-threads=win32 --enable-lto --with-system-zlib \ --enable-libstdcxx-debug --enable-version-specific-runtime-libs --enable-fully-dynamic-string \ --disable-sjlj-exceptions --with-dwarf2 --disable-symvers --enable-checking=release \ --enable-plugins --enable-cloog-backend=isl --enable-static --disable-shared \ --disable-nls --disable-win32-registry My binutils version is : 2.21.53.20110728 I try to build libgmp using PGO and lto as follows: 1) CPPFLAGS=-fexceptions ./configure --prefix=/mingw32 --disable-shared --enable-static --enable-cxx --enable-fat 2) make CFLAGS="-Wno-error=coverage-mismatch -fprofile-generate=e:/t/temp/libgmp -flto -pipe -O3" \ CXXFLAGS="-Wno-error=coverage-mismatch -fprofile-generate=e:/t/temp/libgmp -flto -pipe -O3" \ LDFLAGS="-fprofile-generate=e:/t/temp/libgmp -flto -fuse-linker-plugin" 3) then make CFLAGS="-Wno-error=coverage-mismatch -fprofile-generate=e:/t/temp/libgmp -flto -pipe -O3" \ CXXFLAGS="-Wno-error=coverage-mismatch -fprofile-generate=e:/t/temp/libgmp -flto -pipe -O3" \ LDFLAGS="-fprofile-generate=e:/t/temp/libgmp -flto -fuse-linker-plugin" check to gather the profile information. There is not any problem above. 4) make clean 5) Using the profile information to recompile. make CFLAGS="-Wno-error=coverage-mismatch -fprofile-use=e:/t/temp/libgmp -flto -pipe -O3" \ CXXFLAGS="-Wno-error=coverage-mismatch -fprofile-use=e:/t/temp/libgmp -flto -pipe -O3" \ LDFLAGS="-fprofile-use=e:/t/temp/libgmp -flto -fuse-linker-plugin" 6) make check will result in errors. make CFLAGS="-Wno-error=coverage-mismatch -fprofile-use=e:/t/temp/libgmp -flto -pipe -O3" \ CXXFLAGS="-Wno-error=coverage-mismatch -fprofile-use=e:/t/temp/libgmp -flto -pipe -O3" \ LDFLAGS="-fprofile-use=e:/t/temp/libgmp -flto -fuse-linker-plugin" check The errors are like : -------------------------------------------------------------------------------- libtool: link: gcc -std=gnu99 -pipe -flto -O3 -fomit-frame-pointer -momit-leaf-frame-pointer -minline-all-stringops -minline-stringops-dynamically -fivopts -ftree-loop-linear -ftree-loop-distribution -ftree-vectorize -fvect-cost-model -fgraphite-identity -floop-interchange -floop-block -floop-parallelize-all -fforce-addr -fno-bounds-check -mmmx -msse -msse2 -maccumulate-outgoing-args -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -s -flto -fuse-linker-plugin -Wl,--allow-multiple-definition -Wl,--large-address-aware -o t-bswap.exe t-bswap.o ./.libs/libtests.a /e/new/gcc/build/gmp/.libs/libgmp.a ../.libs/libgmp.a In file included from :2:0: toom2_sqr.c: In function '__gmpn_toom2_sqr': toom2_sqr.c:58:1: internal compiler error: in scale_bbs_frequencies_gcov_type, at cfg.c:1079 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: e:\MyPack\MinGW\bin\gcc.exe returned 1 exit status e:/mypack/mingw/bin/../lib/gcc/i686-pc-mingw32/4.6.1/../../../../i686-pc-mingw32/bin/ld.exe: lto-wrapper failed collect2: ld returned 1 exit status make[4]: *** [t-bswap.exe] Error 1 -------------------------------------------------------------------------------- I don't know it is the gcov, gcc lto, lto plugin bug?