diff mbox

[6/N] Do not warn -Wsuggest-attribute=noreturn for main.chkp (PR, middle-end/78339).

Message ID 9787a009-60c9-e4df-6cdb-24e7209059b9@suse.cz
State New
Headers show

Commit Message

Martin Liška March 9, 2017, 2:19 p.m. UTC
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

Comments

Richard Biener March 13, 2017, 12:29 p.m. UTC | #1
On Thu, Mar 9, 2017 at 3:19 PM, Martin Liška <mliska@suse.cz> wrote:
> 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?

Ok.

RIchard.

> Martin
diff mbox

Patch

From 1235ced464fa990eaa4157ea216aeac7e4023b06 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
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  <mliska@suse.cz>

	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  <mliska@suse.cz>

	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<tree> *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