Hi,
this error recovery ICE happens only with -Os and is just a P5 - on the
other hand I would argue the reproducer isn't that exotic! - but seems
fixable easily and safely: cdtor_comdat_group immediately calls
DECL_ASSEMBLER_NAME on both arguments and of course crashes if they are
null. Tested x86_64-linux.
Thanks, Paolo.
//////////////////
/cp
2018-03-02 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/71464
* optimize.c (maybe_thunk_body): When HAVE_COMDAT_GROUP is true,
bail out immediately if either fns[1] or fns[0] is null.
/testsuite
2018-03-02 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/71464
* g++.dg/torture/pr71464.C: New.
Index: cp/optimize.c
===================================================================
--- cp/optimize.c (revision 258151)
+++ cp/optimize.c (working copy)
@@ -276,6 +276,9 @@ maybe_thunk_body (tree fn, bool force)
{
/* At eof, defer creation of mangling aliases temporarily. */
bool save_defer_mangling_aliases = defer_mangling_aliases;
+ if (!fns[1] || !fns[0])
+ /* Can happen during error recovery (c++/71464). */
+ return 0;
defer_mangling_aliases = true;
tree comdat_group = cdtor_comdat_group (fns[1], fns[0]);
defer_mangling_aliases = save_defer_mangling_aliases;
Index: testsuite/g++.dg/torture/pr71464.C
===================================================================
--- testsuite/g++.dg/torture/pr71464.C (nonexistent)
+++ testsuite/g++.dg/torture/pr71464.C (working copy)
@@ -0,0 +1,7 @@
+struct A {};
+
+struct B : virtual A
+{
+ B () {};
+ B () {}; // { dg-error "cannot be overloaded" }
+};