From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77519 invoked by alias); 9 Mar 2017 14:19:34 -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 77503 invoked by uid 89); 9 Mar 2017 14:19:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy= 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; Thu, 09 Mar 2017 14:19:32 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1EF8BAAC7 for ; Thu, 9 Mar 2017 14:19:31 +0000 (UTC) From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH 6/N] Do not warn -Wsuggest-attribute=noreturn for main.chkp (PR, middle-end/78339). To: gcc-patches@gcc.gnu.org References: Message-ID: <9787a009-60c9-e4df-6cdb-24e7209059b9@suse.cz> Date: Thu, 09 Mar 2017 14:19:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------C020CA1EF6BB5F89EA09C891" X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00425.txt.bz2 This is a multi-part message in MIME format. --------------C020CA1EF6BB5F89EA09C891 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Content-length: 206 Hello. Following patch fixes issue by checking original declaration instead of instrumentation clone. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Martin --------------C020CA1EF6BB5F89EA09C891 Content-Type: text/x-patch; name="0001-Do-not-warn-Wsuggest-attribute-noreturn-for-main.chk.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Do-not-warn-Wsuggest-attribute-noreturn-for-main.chk.pa"; filename*1="tch" Content-length: 1993 >From 1235ced464fa990eaa4157ea216aeac7e4023b06 Mon Sep 17 00:00:00 2001 From: marxin Date: Tue, 7 Mar 2017 16:27:40 +0100 Subject: [PATCH] Do not warn -Wsuggest-attribute=noreturn for main.chkp (PR middle-end/78339). gcc/ChangeLog: 2017-03-07 Martin Liska PR middle-end/78339 * ipa-pure-const.c (warn_function_noreturn): If the declarations is a CHKP clone, use original declaration. gcc/testsuite/ChangeLog: 2017-03-07 Martin Liska PR middle-end/78339 * gcc.target/i386/mpx/pr78339.c: New test. --- gcc/ipa-pure-const.c | 8 +++++++- gcc/testsuite/gcc.target/i386/mpx/pr78339.c | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pr78339.c diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 5cc2002d024..5c6f775c4ac 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -218,11 +218,17 @@ warn_function_const (tree decl, bool known_finite) static void warn_function_noreturn (tree decl) { + tree original_decl = decl; + + cgraph_node *node = cgraph_node::get (decl); + if (node->instrumentation_clone) + decl = node->instrumented_version->decl; + static hash_set *warned_about; if (!lang_hooks.missing_noreturn_ok_p (decl) && targetm.warn_func_return (decl)) warned_about - = suggest_attribute (OPT_Wsuggest_attribute_noreturn, decl, + = suggest_attribute (OPT_Wsuggest_attribute_noreturn, original_decl, true, warned_about, "noreturn"); } diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr78339.c b/gcc/testsuite/gcc.target/i386/mpx/pr78339.c new file mode 100644 index 00000000000..3dd04240e8c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr78339.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx -Wsuggest-attribute=noreturn" } */ + +extern _Noreturn void exit (int); +int main (void) { exit (1); } -- 2.11.1 --------------C020CA1EF6BB5F89EA09C891--