https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100010
Bug ID: 100010 Summary: ICE in lto_output_node, at lto-cgraph.c:447 (-fdevirtualize-at-ltrans) Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: alex.miller at gmx dot de CC: marxin at gcc dot gnu.org Target Milestone: --- Building lcdf-typetools-2.108 fails with an ICE while linking the mmafm tool (with gcc-10 using the flags "-O3 -flto -fdevirtualize-at-ltrans"). Here's a reduced sample that reproduces the issue (even with -O2): --- struct String { String(char); ~String(); }; struct ErrorHandler { virtual String decorate(const String &); }; String ErrorHandler::decorate(const String &str) { decorate(str); return 0; } struct LandmarkErrorHandler : ErrorHandler { String _landmark; LandmarkErrorHandler(); String decorate(const String &); }; String LandmarkErrorHandler::decorate(const String &) { return ErrorHandler::decorate(0); } struct Charstring { virtual ~Charstring(); virtual void process() = 0; } *interpret_cs; Charstring::~Charstring() {} struct : Charstring { void process() {} } _cdv; int main() { LandmarkErrorHandler(); interpret_cs->process(); } --- $ g++ -O2 -flto -fdevirtualize-at-ltrans a.cc during IPA pass: static-var lto1: internal compiler error: in lto_output_node, at lto-cgraph.c:447 Please submit a full bug report, with preprocessed source if appropriate. See <https://bugs.gentoo.org/> for instructions. lto-wrapper: fatal error: g++ returned 1 exit status compilation terminated. /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status Reducing the sources seems a bit brittle, like often with LTO: * Combining all sources in a single file changed the error message to "lto1: internal compiler error: Segmentation fault", but minimizing made the error location reappear. The result is very similar to a multi-file reduction. * Reduced sample fails with -O2, full sources need -O3. * With g++-9.3.0 the reduced sample doesn't trigger the ICE, but the original sources do (at lto-cgraph.c:453). Let me know if you need another sample.