From patchwork Sat Nov 17 12:40:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 199850 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id AD6AF2C008F for ; Sat, 17 Nov 2012 23:40:43 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1353760845; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Cc:Subject:Message-ID:Mail-Followup-To:MIME-Version: Content-Type:Content-Disposition:User-Agent:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=CR6ZzkG/eHzxkBJESCtjhuutsQs=; b=s60gmUqDiLXU13sV1z4VrEfGjdmj9O+fPQZzV/8EZ7a34kfFMZ3dRcx5n68Qjp RqHgAPWUKu8lHg3YGrG2QF1UUsVNaKeeUUIOKyrpjrV1vzGreEF/nc3UzXGQpTKQ nwcQ0eqV3m7yjTw8kt9V691WjOLinlWS7kgARf4fz6tTA= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=GLTe3MVH/dRFVhIye3uLQfIbz2Bt6VrsZgfBvMqRVaqMVGDnDWV/dFeAe5ljpR aPuLzg7XI4h71TE78sf3pFHuGwyTNw0sCbOKgRfna1BkH55gIinyD6sCTgCJ9dTU In5b5IN8w+5Zw6L7WX5Zwa5bE26u9Vm3JcwvRMB11nUqc=; Received: (qmail 22049 invoked by alias); 17 Nov 2012 12:40:40 -0000 Received: (qmail 22041 invoked by uid 22791); 17 Nov 2012 12:40:39 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 17 Nov 2012 12:40:32 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 5E511A24CA; Sat, 17 Nov 2012 13:40:31 +0100 (CET) Date: Sat, 17 Nov 2012 13:40:30 +0100 From: Martin Jambor To: GCC Patches Cc: Jan Hubicka Subject: [PATCH, PR 55260] Use info of the correct node in find_aggregate_values_for_callers_subset Message-ID: <20121117124030.GC21085@virgil.arch.suse.de> Mail-Followup-To: GCC Patches , Jan Hubicka MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, PR 55260 contains two testcases which trigger two different bugs in ipa-cp.c. The first problem is that at one place in find_aggregate_values_for_callers_subset we use variable info instead of caller_info when determining whether a callee is a clone which then leads to an ICE. Fixed thusly and I also renamed info to dest_info to make similar mistakes harder to make in future. Fix of the second PR 55260 bug will probably involve some fiddling with vectors so I'll submit it next week when the new interface is in place. Bootstrapped and tested on x86_64-linux, OK for trunk? Thanks, Martin 2012-11-16 Martin Jambor PR tree-optimization/55260 * ipa-cp.c (find_aggregate_values_for_callers_subset): Rename info to dest_info, use caller_info instead of info when determining whether callee is a clone. * testsuite/g++.dg/torture/pr55260-1.C: New test. Index: src/gcc/testsuite/g++.dg/torture/pr55260-1.C =================================================================== --- /dev/null +++ src/gcc/testsuite/g++.dg/torture/pr55260-1.C @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu++0x -fno-inline" } */ +/* { dg-add-options bind_pic_locally } */ + + struct B + { + constexpr B (): + bp () + {} + ~B () + { + if (bp) + bp->f (); + } + void f (); + B *bp; + }; +struct A { B b; +}; + +void foo () +{ + A a; +} Index: src/gcc/ipa-cp.c =================================================================== --- src.orig/gcc/ipa-cp.c +++ src/gcc/ipa-cp.c @@ -2870,10 +2870,10 @@ static struct ipa_agg_replacement_value find_aggregate_values_for_callers_subset (struct cgraph_node *node, VEC (cgraph_edge_p,heap) *callers) { - struct ipa_node_params *info = IPA_NODE_REF (node); + struct ipa_node_params *dest_info = IPA_NODE_REF (node); struct ipa_agg_replacement_value *res = NULL; struct cgraph_edge *cs; - int i, j, count = ipa_get_param_count (info); + int i, j, count = ipa_get_param_count (dest_info); FOR_EACH_VEC_ELT (cgraph_edge_p, callers, j, cs) { @@ -2891,7 +2891,7 @@ find_aggregate_values_for_callers_subset /* Among other things, the following check should deal with all by_ref mismatches. */ - if (ipa_get_parm_lattices (info, i)->aggs_bottom) + if (ipa_get_parm_lattices (dest_info, i)->aggs_bottom) continue; FOR_EACH_VEC_ELT (cgraph_edge_p, callers, j, cs) @@ -2943,7 +2943,7 @@ find_aggregate_values_for_callers_subset struct ipcp_param_lattices *src_plats; HOST_WIDE_INT delta = ipa_get_jf_ancestor_offset (jfunc); - if (info->ipcp_orig_node) + if (caller_info->ipcp_orig_node) { if (!inter) inter = agg_replacements_to_vector (cs->caller, delta);