https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65130
Bug ID: 65130 Summary: ICE with LTO on valid code on x86_64-linux-gnu Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu The following code causes an ICE when compiled with the current gcc trunk with LTO on x86_64-linux-gnu in both 32-bit and 64-bit modes. It is a regression from 4.9.x. $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 5.0.0 20150219 (experimental) [trunk revision 220822] (GCC) $ $ gcc-4.9 -flto -O1 -c foo.c $ gcc-4.9 -flto -O2 -c main.c $ gcc-4.9 -flto -O1 foo.o main.o $ ./a.out $ $ gcc-trunk -flto -O1 -c foo.c $ gcc-trunk -flto -O2 -c main.c $ gcc-trunk -flto -O1 foo.o main.o gcc-trunk: internal compiler error: Segmentation fault (program lto1) Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: fatal error: gcc-trunk returned 4 exit status compilation terminated. /usr/bin/ld: lto-wrapper failed collect2: error: ld returned 1 exit status $ $ cat foo.c extern void fn3 (void); void fn2(void) { fn3(); } void fn1(void) { fn2(); } void fn4(void) { fn2(); } $ cat main.c extern void fn1(void); extern void fn4 (void); int a; void fn3(void) { for (; a;) fn4(); } int main() { fn1(); return 0; } $