From: Paolo Carlini Date: Sat, 3 Mar 2018 17:48:23 +0000 (+0000) Subject: re PR c++/71464 (ICE on invalid code (with redeclared constructor) at -Os: Segmentati... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c94a3f9f6580097dfc9279132a312780e5fa5405;p=gcc.git re PR c++/71464 (ICE on invalid code (with redeclared constructor) at -Os: Segmentation fault) /cp 2018-03-03 Paolo Carlini 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 PR c++/71464 * g++.dg/torture/pr71464.C: New. From-SVN: r258216 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 69201090690..391aa5f11fe 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-03-03 Paolo Carlini + + 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 PR c++/84578 diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c index a1cb610c06a..fdb1650939e 100644 --- a/gcc/cp/optimize.c +++ b/gcc/cp/optimize.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a867711183b..b5b57798c41 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-03 Paolo Carlini + + PR c++/71464 + * g++.dg/torture/pr71464.C: New. + 2018-03-03 Paul Thomas 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 index 00000000000..0ed7de79e88 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr71464.C @@ -0,0 +1,7 @@ +struct A {}; + +struct B : virtual A +{ + B () {}; + B () {}; // { dg-error "cannot be overloaded" } +};