https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62026
--- Comment #11 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- Thanks for the testcase. Reduced: markus@x4 /tmp % cat ErrorTry.ii template <typename T> class B { public: T values; T operator[](int); }; class C; class D { public: int m_fn2(); virtual C *m_fn1(); }; class C : public D { public: virtual B<int> *m_fn3(int); }; class F : D, C { B<int> *offsets; B<int> *m_fn3(int); }; B<int> *F::m_fn3(int) { if (offsets) return 0; } void fn1(B<D *> &p1) { for (int i;;) { C *a = p1[0]->m_fn1(); a->m_fn2() && a->m_fn3(0); } } markus@x4 /tmp % g++ -flto -O3 -r -nostdlib ErrorTry.ii ErrorTry.ii:17:7: warning: direct base āDā inaccessible in āFā due to ambiguity class F : D, C { ^ lto1: internal compiler error: Segmentation fault 0x943f9f crash_signal ../../gcc/gcc/toplev.c:340 0x843af8 lto_get_decl_name_mapping(lto_file_decl_data*, char const*) ../../gcc/gcc/lto-section-in.c:340 0x83ce96 copy_function_or_variable ../../gcc/gcc/lto-streamer-out.c:2163 0x83dae1 lto_output() ../../gcc/gcc/lto-streamer-out.c:2255 0x889701 write_lto ../../gcc/gcc/passes.c:2228 0x88cccb ipa_write_optimization_summaries(lto_symtab_encoder_d*) ../../gcc/gcc/passes.c:2425 0x55db6a do_stream_out ../../gcc/gcc/lto/lto.c:2463 0x55f849 stream_out ../../gcc/gcc/lto/lto.c:2505 0x55f849 lto_wpa_write_files ../../gcc/gcc/lto/lto.c:2642 0x568a94 do_whole_program_analysis ../../gcc/gcc/lto/lto.c:3310 0x568a94 lto_main() ../../gcc/gcc/lto/lto.c:3430 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.