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-Tag: upstream/12.2.0~33061 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c94a3f9f6580097dfc9279132a312780e5fa5405;p=platform%2Fupstream%2Fgcc.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 6920109..391aa5f 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 a1cb610..fdb1650 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 a867711..b5b5779 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 0000000..0ed7de7 --- /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" } +};