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
@@ -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");
}
new file mode 100644
@@ -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