$ ~/inst/bin/gcc -v Using built-in specs. COLLECT_GCC=/home/edwin/inst/bin/gcc COLLECT_LTO_WRAPPER=/home/edwin/inst/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc/configure --enable-lto --enable-languages=c,c++ --enable-gold Thread model: posix gcc version 4.5.0 20091019 (experimental) (GCC)
gcc -flto fails to compile ClamAV when built with --disable-shared, I reduced the problem to these two files: $ /home/edwin/inst/bin/gcc -flto 7z.i -o 7z.o -c $ /home/edwin/inst/bin/gcc -flto 7zIn.i -o 7zIn.o -c $ /home/edwin/inst/bin/gcc 7z.o 7zIn.o -flto -shared -use-linker-plugin In function SzArEx_GetFolderFullPackSize: lto1: error: type mismatch in component reference const struct CSzAr struct CSzAr D.1996_3 = p_2(D)->db.Folders; lto1: internal compiler error: verify_stmts failed Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: /home/edwin/inst/bin/gcc returned 1 exit status /usr/bin/ld: fatal error: lto-wrapper failed collect2: ld returned 1 exit status -- Summary: lto1: error: type mismatch in component reference (const with non-const) Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: edwintorok at gmail dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41761