From c94a3f9f6580097dfc9279132a312780e5fa5405 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Sat, 3 Mar 2018 17:48:23 +0000 Subject: 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 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/optimize.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'gcc/cp') 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; -- cgit v1.1