This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 6/N] Do not warn -Wsuggest-attribute=noreturn for main.chkp (PR, middle-end/78339).
- From: Martin Liška <mliska at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 9 Mar 2017 15:19:30 +0100
- Subject: [PATCH 6/N] Do not warn -Wsuggest-attribute=noreturn for main.chkp (PR, middle-end/78339).
- Authentication-results: sourceware.org; auth=none
- References: <cover.1488881229.git.mliska@suse.cz>
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
>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