ICE is observed when CFLAGS and CXXFLAGS are set to: -O3 -pipe -flto=auto -fdevirtualize-at-ltrans Reproducible: Always Steps to Reproduce: Run: CFLAGS="-O3 -pipe -flto=auto -fdevirtualize-at-ltrans" CXXFLAGS="-O3 -pipe -flto=auto -fdevirtualize-at-ltrans" emerge -1 app-text/lcdf-typetools Actual Results: Here's the relevant output from the build log: during IPA pass: static-var lto1: internal compiler error: Segmentation fault during IPA pass: static-var lto1: internal compiler error: Segmentation fault 0x120f469 internal_error(char const*, ...) ???:0 0x1364950 lto_output() ???:0 0x1a63942 ipa_write_optimization_summaries(lto_symtab_encoder_d*) ???:0 0x1a3ac26 lto_main() ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://bugs.gentoo.org/> for instructions. lto-wrapper: fatal error: g++ returned 1 exit status compilation terminated. 0x120f469 internal_error(char const*, ...) ???:0 0x136a5fc output_symtab() ???:0 0x1364495 lto_output() ???:0 0x1a63942 ipa_write_optimization_summaries(lto_symtab_encoder_d*) ???:0 0x1a3ac74 lto_main() ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://bugs.gentoo.org/> for instructions. /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status The ICE seems to be dependent on the optimization level. -O2 compiles fine. I would submit this bug to GCC's bugtracker, but they've restricted account creation. Maybe someone who already has an account could submit the bug for me.
Created attachment 873623 [details] lcdf-typetools-2.108-r1-build.log
Thanks. I added this filter earlier today; commit b465fdbfa7432627d207a6305b63cac882120c86 Author: Sam James <sam@gentoo.org> Date: Sat Oct 28 08:07:38 2023 +0100 app-text/lcdf-typetools: avoid known GCC ICE with -fdevirtualize-at-ltrans Bug: https://gcc.gnu.org/PR100010 Signed-off-by: Sam James <sam@gentoo.org>
To reproduce you also need to have the flags in LDFLAGS, otherwise I cannot reproduce. CFLAGS="-O3 -pipe -flto=auto -fdevirtualize-at-ltrans" CXXFLAGS="-O3 -pipe -flto=auto -fdevirtualize-at-ltrans" LDFLAGS="-Wl,-O1 -Wl,--as-needed -O3 -pipe -flto=auto -fdevirtualize-at-ltrans"