https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96291
--- Comment #5 from Sergei Trofimovich <slyfox at inbox dot ru> --- I shrunk example to "single-file" (almost) example to ease local tweaking: $ cat 1file.c void e(void); void f(void); void a(int, int); void c(int); #ifdef COMPILE_F1 int b; void c(int d) { f(); a(b, 0); } void e(void) { c(0); } #endif #ifdef COMPILE_F2 void f(void) { c(0); } #endif #ifdef COMPILE_F3 void a(int a1, int a2) { e(); } #endif $ x86_64-pc-linux-gnu-gcc -c -O2 -flto -o f1.o 1file.c -DCOMPILE_F1 $ x86_64-pc-linux-gnu-gcc -c -O2 -flto -o f2.o 1file.c -DCOMPILE_F2 $ x86_64-pc-linux-gnu-gcc -c -O2 -flto -O0 -o f3.o 1file.c -DCOMPILE_F3 $ x86_64-pc-linux-gnu-gcc -O2 -flto -o sdb f1.o f2.o f3.o during IPA pass: cp lto1: internal compiler error: Segmentation fault