https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86412

            Bug ID: 86412
           Summary: lto1: internal compiler error: in
                    lto_symtab_prevailing_virtual_decl, at
                    lto/lto-symtab.c
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: skvadrik at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Created attachment 44354
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44354&action=edit
minimal reproducer

Minimal reproducer (bug.cpp in attach):


template <typename> class a;
template <typename> class b;
class c {
  virtual bool d();
};
template <typename> class e : c {
public:
  template <typename f> e(f);
};


Crash:


$ g++ -flto bug.cpp -O2
lto1: internal compiler error: in lto_symtab_prevailing_virtual_decl, at
lto/lto-symtab.c:1085
0x741dea lto_symtab_prevailing_virtual_decl(tree_node*)
       
/usr/src/debug/sys-devel/gcc-8.1.0-r3/gcc-8.1.0/gcc/lto/lto-symtab.c:1084
0x734977 lto_symtab_prevailing_decl(tree_node*)
        /usr/src/debug/sys-devel/gcc-8.1.0-r3/gcc-8.1.0/gcc/lto/lto-symtab.h:53
0x734977 lto_fixup_prevailing_decls
        /usr/src/debug/sys-devel/gcc-8.1.0-r3/gcc-8.1.0/gcc/lto/lto.c:2678
0x734977 lto_fixup_decls
        /usr/src/debug/sys-devel/gcc-8.1.0-r3/gcc-8.1.0/gcc/lto/lto.c:2744
0x734977 read_cgraph_and_symbols
        /usr/src/debug/sys-devel/gcc-8.1.0-r3/gcc-8.1.0/gcc/lto/lto.c:2989
0x734977 lto_main()
        /usr/src/debug/sys-devel/gcc-8.1.0-r3/gcc-8.1.0/gcc/lto/lto.c:3401
Please submit a full bug report,
with preprocessed source if appropriate.
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.
/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0/../../../../x86_64-pc-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status


Notes:
- no crash with -O1 or -O0
- GCC-9 built on 01st of July 2018 also crashes (the assert line is now 1076)
- I attach a large file (bug.cpp.orig) that can be used to check the fix (the
original crash happened on a large proprietary project)

Reply via email to