From patchwork Wed Aug 13 12:25:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 379627 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 3B96F140077 for ; Wed, 13 Aug 2014 22:26:16 +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=ZkdWje9zLSde6vifu2fDJbRTcKTq7tMEmxnlZKlsA36r3KCv3P8BP wYhJ8nxTbjIG7P97yomptQI5iRUgWMjbTeHFySVykIqLbZzdxZ9uWxjSIjNURJo7 UhHk+u6O8G9/HyGed4h9epNai2kMj8ViWfm0SrB4FlekBwk+xfP0M8= 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=Iki61K1kqYjEmzsbO0DK+l6M9F4=; b=Aw4izELJPE2vcRdfrYH5 Vc02YQMGk5D472/WgkRgsFLSUBqi1VZFuraervmXd9dLsDJshfdDk8K84J5ABXl3 K+BRxszBtrdH2MWE9UNoCnpzknPHmNHnWbwAGwa8U1epGVontmYLMzM9QoICaz5f kHDRn1nnKV1Di+ie908LGRE= Received: (qmail 19153 invoked by alias); 13 Aug 2014 12:26:09 -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 19138 invoked by uid 89); 13 Aug 2014 12:26:08 -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-f50.google.com Received: from mail-pa0-f50.google.com (HELO mail-pa0-f50.google.com) (209.85.220.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 13 Aug 2014 12:26:06 +0000 Received: by mail-pa0-f50.google.com with SMTP id et14so14822707pad.37 for ; Wed, 13 Aug 2014 05:26:04 -0700 (PDT) X-Received: by 10.66.227.196 with SMTP id sc4mr3696527pac.109.1407932764822; Wed, 13 Aug 2014 05:26:04 -0700 (PDT) Received: from msticlxl57.ims.intel.com (fmdmzpr01-ext.fm.intel.com. [192.55.54.36]) by mx.google.com with ESMTPSA id px5sm1994319pbc.23.2014.08.13.05.26.03 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Aug 2014 05:26:04 -0700 (PDT) Date: Wed, 13 Aug 2014 16:25:49 +0400 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix wrong refactoring in cgraph_node::function_symbol Message-ID: <20140813122549.GA29331@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi, This patch is to fix wrong refactoring for cgraph_node::function_symbol introduced by this patch: https://gcc.gnu.org/ml/gcc-cvs/2014-07/msg00805.html. Here is how function was refactored: -cgraph_function_node (struct cgraph_node *node, enum availability *availability) +cgraph_node * +cgraph_node::function_symbol (enum availability *availability) { + cgraph_node *node = NULL; + do { - node = cgraph_function_or_thunk_node (node, availability); + node = ultimate_alias_target (availability); if (node->thunk.thunk_p) { node = node->callees->callee; if (availability) { enum availability a; - a = cgraph_function_body_availability (node); + a = node->get_availability (); if (a < *availability) *availability = a; } - node = cgraph_function_or_thunk_node (node, availability); + node = node->ultimate_alias_target (availability); } } while (node && node->thunk.thunk_p); return node; } first ultimate_alias_target call always uses 'this' instead of 'node'. This causes infinite loop. Patch was bootstrapped and regtested on linux-x86_64. OK for trunk? Thanks, Ilya --- 2014-08-13 Ilya Enkovich * cgraph.c (cgraph_node::function_symbol): Fix wrong cgraph_function_node to cgraph_node::function_symbol refactoring. diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 5a0b903..370a96a 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -3000,11 +3000,11 @@ cgraph_node::verify_cgraph_nodes (void) cgraph_node * cgraph_node::function_symbol (enum availability *availability) { - cgraph_node *node = NULL; + cgraph_node *node = this; do { - node = ultimate_alias_target (availability); + node = node->ultimate_alias_target (availability); if (node->thunk.thunk_p) { node = node->callees->callee;