re PR c++/71464 (ICE on invalid code (with redeclared constructor) at -Os: Segmentati...
authorPaolo Carlini <paolo.carlini@oracle.com>
Sat, 3 Mar 2018 17:48:23 +0000 (17:48 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sat, 3 Mar 2018 17:48:23 +0000 (17:48 +0000)
/cp
2018-03-03  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/71464
* optimize.c (maybe_thunk_body): Bail out immediately if either
fns[0] or fns[1] is null.

/testsuite
2018-03-03  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/71464
* g++.dg/torture/pr71464.C: New.

From-SVN: r258216

gcc/cp/ChangeLog
gcc/cp/optimize.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr71464.C [new file with mode: 0644]

index 692010906903cabbcbd31d5a7cf183cedb6ecaf0..391aa5f11fe831564a4c100c3b1600a798e7591d 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-03  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/71464
+       * optimize.c (maybe_thunk_body): Bail out immediately if either
+       fns[0] or fns[1] is null.
+
 2018-03-02  Marek Polacek  <polacek@redhat.com>
 
        PR c++/84578
index a1cb610c06a1a7a7f1e8db6d46239239180f3949..fdb1650939e9c5d89a0435e000f463987967f173 100644 (file)
@@ -261,8 +261,12 @@ maybe_thunk_body (tree fn, bool force)
 
   populate_clone_array (fn, fns);
 
+  /* Can happen during error recovery (c++/71464).  */
+  if (!fns[0] || !fns[1])
+    return 0;
+
   /* Don't use thunks if the base clone omits inherited parameters.  */
-  if (fns[0] && ctor_omit_inherited_parms (fns[0]))
+  if (ctor_omit_inherited_parms (fns[0]))
     return 0;
 
   DECL_ABSTRACT_P (fn) = false;
index a867711183bc1f3a66e58f80b5cb22b2cedf879a..b5b57798c410f7728b4862b2145e52bcae4ad553 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-03  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/71464
+       * g++.dg/torture/pr71464.C: New.
+
 2018-03-03  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/80965
diff --git a/gcc/testsuite/g++.dg/torture/pr71464.C b/gcc/testsuite/g++.dg/torture/pr71464.C
new file mode 100644 (file)
index 0000000..0ed7de7
--- /dev/null
@@ -0,0 +1,7 @@
+struct A {}; 
+
+struct B : virtual A
+{
+  B () {};
+  B () {};  // { dg-error "cannot be overloaded" }
+};