From patchwork Wed Aug 13 14:17:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 379656 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6669A140080 for ; Thu, 14 Aug 2014 00:17:58 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=ZaFGDU5sRnpD26Inpx6PewdRx0NMHzxkMIDdVzcWIbccwBHB7se7z +xwm3qhuqax/6MZri7sM7sqcXGH+Hezcpowziyn6+HqLWnxnZDQawlEz7fP3Mr3D sSKhy3qSP6xNHaB0ozp+wibyI+N7sckzv41UG5/CVcnpnlB8BRI52o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=EPaC+PrbsJema39D4IBKlptUeic=; b=PNft5cLfdnniVcbIOTTh 7PVpAQknlNS4COkxJ/qbT+7NUcKGL1hZIt7Id05x6mRlIgMVGV9v1oRPNbGwpgj8 z7ZuHh4VCk7Ic99inuixORSZscelA1sg69oyXNT1aw9y8MPlvm5Y3c8PD64a4J+E Vl2FWGGev012aG/DyqzyY58= Received: (qmail 20644 invoked by alias); 13 Aug 2014 14:17:52 -0000 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 Received: (qmail 20631 invoked by uid 89); 13 Aug 2014 14:17:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f51.google.com Received: from mail-pa0-f51.google.com (HELO mail-pa0-f51.google.com) (209.85.220.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 13 Aug 2014 14:17:50 +0000 Received: by mail-pa0-f51.google.com with SMTP id ey11so14852680pad.24 for ; Wed, 13 Aug 2014 07:17:48 -0700 (PDT) X-Received: by 10.70.88.75 with SMTP id be11mr3805194pdb.69.1407939468477; Wed, 13 Aug 2014 07:17:48 -0700 (PDT) Received: from msticlxl57.ims.intel.com (fmdmzpr01-ext.fm.intel.com. [192.55.54.36]) by mx.google.com with ESMTPSA id mz8sm3296334pdb.62.2014.08.13.07.17.46 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Aug 2014 07:17:48 -0700 (PDT) Date: Wed, 13 Aug 2014 18:17:42 +0400 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH] Remove current_function_decl usage from get_polymorphic_call_info Message-ID: <20140813141742.GB29331@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi, Testing 'mpx' branch after merge with trunk I got a segfault in ipa-devirt.c. It appears that cgraph_node cloning with indirect edge causes call to get_polymorphic_call_info which uses current_function_decl. It happens in IPA pass and therefore current_function_decl is NULL which causes segfault. Also even within a GIMPLE pass it seems wrong to use current_function_decl because examined call may belong to another function and passed fndecl should be used instead. Proposed patch was bootstrapped and regtested on linux-x86_64. OK for trunk? Thanks, Ilya --- 2014-08-13 Ilya Enkovich * ipa-devirt.c (get_polymorphic_call_info): Use fndecl instead of current_function_decl. diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 3650b43..0f38655 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -2319,7 +2319,7 @@ get_polymorphic_call_info (tree fndecl, = decl_maybe_in_construction_p (base, context->outer_type, call, - current_function_decl); + fndecl); return base; } else