From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20288 invoked by alias); 18 Jan 2015 17:43:56 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 20273 invoked by uid 89); 18 Jan 2015 17:43:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 18 Jan 2015 17:43:46 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id B71C0541720; Sun, 18 Jan 2015 18:43:41 +0100 (CET) Date: Sun, 18 Jan 2015 17:51:00 -0000 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix ipa-inline-transform ICE Message-ID: <20150118174341.GA17433@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2015-01/txt/msg01604.txt.bz2 Hi, the testcase shows a case where try_make_edge_direct_virtual_call disagrees with ipa_get_indirect_edge_target_1 making ipa-inline-transform to ICE on mismatch. Bootstrapped/regtested x86_64-linux, comitted. Honza Index: ChangeLog =================================================================== --- ChangeLog (revision 219821) +++ ChangeLog (working copy) @@ -1,3 +1,10 @@ +2015-01-18 Jan Hubicka + + PR ipa/64378 + * ipa-prop.c (try_make_edge_direct_virtual_call): Clear speculative + flag correctly. + * ipa-cp.c (ipa_get_indirect_edge_target_1): Handle speculation. + 2015-01-18 Sandra Loosemore * doc/invoke.texi ([-funroll-loops], [-funroll-all-loops]): Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 219821) +++ testsuite/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2015-01-18 Jan Hubicka + + PR ipa/64378 + * g++.dg/torture/pr64378.C: New testcase. + 2015-01-18 Paul Thomas PR fortran/57959 Index: testsuite/g++.dg/torture/pr64378.C =================================================================== --- testsuite/g++.dg/torture/pr64378.C (revision 0) +++ testsuite/g++.dg/torture/pr64378.C (revision 0) @@ -0,0 +1,24 @@ +// { dg-do compile } +// { dg-options "-fno-ipa-cp" } +struct data { + data(int) {} +}; + +struct top { + virtual int topf() {} +}; + +struct child1: top { + void childf() + { + data d(topf()); + } +}; + +void test(top *t) +{ + child1 *c = static_cast(t); + c->childf(); + child1 d; + test(&d); +} Index: ipa-prop.c =================================================================== --- ipa-prop.c (revision 219821) +++ ipa-prop.c (working copy) @@ -2985,7 +2985,7 @@ try_make_edge_direct_virtual_call (struc || !possible_polymorphic_call_target_p (ie, cgraph_node::get (t))) { - /* Do not speculate builtin_unreachable, it is stpid! */ + /* Do not speculate builtin_unreachable, it is stupid! */ if (!ie->indirect_info->vptr_changed) target = ipa_impossible_devirt_target (ie, target); } @@ -3013,6 +3013,7 @@ try_make_edge_direct_virtual_call (struc ctx, &final); if (final && targets.length () <= 1) { + speculative = false; if (targets.length () == 1) target = targets[0]->decl; else Index: ipa-cp.c =================================================================== --- ipa-cp.c (revision 219821) +++ ipa-cp.c (working copy) @@ -1975,8 +1975,13 @@ ipa_get_indirect_edge_target_1 (struct c } } else if (t) - context = ipa_polymorphic_call_context (t, ie->indirect_info->otr_type, - anc_offset); + { + context = ipa_polymorphic_call_context (t, ie->indirect_info->otr_type, + anc_offset); + if (ie->indirect_info->vptr_changed) + context.possible_dynamic_type_change (ie->in_polymorphic_cdtor, + ie->indirect_info->otr_type); + } else return NULL_TREE;