From patchwork Fri Jan 13 15:08:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 91442 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp178222obz; Fri, 13 Jan 2017 07:09:25 -0800 (PST) X-Received: by 10.99.163.18 with SMTP id s18mr2282086pge.117.1484320165875; Fri, 13 Jan 2017 07:09:25 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id y190si6915677pfy.194.2017.01.13.07.09.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jan 2017 07:09:25 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-446099-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-446099-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-446099-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:cc:message-id:date:mime-version:content-type; q= dns; s=default; b=TKey0BhMkVJE9Tr0uMudy/aBlh5Pt1T1wTS0oPaM3jWseK wVT0TUdNtdOHVvbULoceB3deOo8tIoXw8k8ENLGthRNvA2H8vgTrqtHgMGXIM8rU 2XGKxPAd+MPOH+6OUbHyozUgzIW6zjzQQvpek36F5iAl5lVOamJ2Q95TZCxRU= 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:to :from:subject:cc:message-id:date:mime-version:content-type; s= default; bh=LejeghV4oc9s8k/V4nUpjl0ySCs=; b=Ki0aJcfxuYhvPdPc6Bhy /C+35vJbfMNoEwkz9lz1D+UVysGOjbAqrlk1Kdw4FgxLO6maaEeSVgFzpeStbBxf ShyaKgZRinYvUmzv92XL7TXo6GAsLCiSHKH769cYgDdvCikTLTJJuHpARzTzel/h GV4uRdfFhDYJkDAyGtFXyPg= Received: (qmail 11364 invoked by alias); 13 Jan 2017 15:08:48 -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 11034 invoked by uid 89); 13 Jan 2017 15:08:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:3347 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Jan 2017 15:08:37 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 57830ABDB; Fri, 13 Jan 2017 15:08:35 +0000 (UTC) To: GCC Patches From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188). Cc: Jan Hubicka Message-ID: <3f5ec8b3-3704-32a9-4db9-6aff7e246c8c@suse.cz> Date: Fri, 13 Jan 2017 16:08:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 X-IsSubscribed: yes Hello. Nice example provided in the PR causes ICE as we have an artificial symbol created in tree-profile.c once being removed by remove unreachable nodes (-O0) and once not (-O1). Well, difference is in process_references where following hunk prevent removal: || (((before_inlining_p && ((TREE_CODE (node->decl) != FUNCTION_DECL && optimize) Anyway, these artificial symbols really should be just declarations as they are defined in libgcov library. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin >From 87262b1b60009381fd943fb433bc38f5d5685ac9 Mon Sep 17 00:00:00 2001 From: marxin Date: Fri, 13 Jan 2017 13:12:57 +0100 Subject: [PATCH] Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188). gcc/testsuite/ChangeLog: 2017-01-13 Martin Liska PR lto/69188 * gcc.dg/lto/pr69188_0.c: New test. * gcc.dg/lto/pr69188_1.c: New test. gcc/ChangeLog: 2017-01-13 Martin Liska PR lto/69188 * tree-profile.c (init_ic_make_global_vars): Do not call finalize_decl. (gimple_init_gcov_profiler): Likewise. --- gcc/testsuite/gcc.dg/lto/pr69188_0.c | 7 +++++++ gcc/testsuite/gcc.dg/lto/pr69188_1.c | 10 ++++++++++ gcc/tree-profile.c | 6 ------ 3 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/lto/pr69188_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/pr69188_1.c diff --git a/gcc/testsuite/gcc.dg/lto/pr69188_0.c b/gcc/testsuite/gcc.dg/lto/pr69188_0.c new file mode 100644 index 00000000000..8bee874a65b --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr69188_0.c @@ -0,0 +1,7 @@ +/* PR ipa/69188 */ +/* { dg-lto-do link } */ +/* { dg-lto-options { { -flto -O0 -fprofile-generate } } } */ + +void fn1(void) +{ +} diff --git a/gcc/testsuite/gcc.dg/lto/pr69188_1.c b/gcc/testsuite/gcc.dg/lto/pr69188_1.c new file mode 100644 index 00000000000..3ed9d5560c6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr69188_1.c @@ -0,0 +1,10 @@ +/* PR ipa/69188 */ +/* { dg-options "-flto -O1 -fprofile-generate" } */ + +extern void fn1(void); + +int main() { + fn1(); + return 0; +} + diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c index 186cfdf7929..a49ec37f8bb 100644 --- a/gcc/tree-profile.c +++ b/gcc/tree-profile.c @@ -94,8 +94,6 @@ init_ic_make_global_vars (void) if (targetm.have_tls) set_decl_tls_model (ic_void_ptr_var, decl_default_tls_model (ic_void_ptr_var)); - varpool_node::finalize_decl (ic_void_ptr_var); - gcov_type_ptr = build_pointer_type (get_gcov_type ()); ic_gcov_type_ptr_var @@ -112,8 +110,6 @@ init_ic_make_global_vars (void) DECL_INITIAL (ic_gcov_type_ptr_var) = NULL; if (targetm.have_tls) set_decl_tls_model (ic_gcov_type_ptr_var, decl_default_tls_model (ic_gcov_type_ptr_var)); - - varpool_node::finalize_decl (ic_gcov_type_ptr_var); } /* Create the type and function decls for the interface with gcov. */ @@ -210,8 +206,6 @@ gimple_init_gcov_profiler (void) DECL_ARTIFICIAL (tree_time_profiler_counter) = 1; DECL_INITIAL (tree_time_profiler_counter) = NULL; - varpool_node::finalize_decl (tree_time_profiler_counter); - /* void (*) (gcov_type *, gcov_type) */ average_profiler_fn_type = build_function_type_list (void_type_node, -- 2.11.0