From a48018b5dc804de7b8c07197bff56e57269d67a2 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 13 Mar 2017 16:30:17 +0100 Subject: [PATCH] Do not warn -Wsuggest-attribute=noreturn for main.chkp (PR middle-end/78339). 2017-03-13 Martin Liska PR middle-end/78339 * ipa-pure-const.c (warn_function_noreturn): If the declarations is a CHKP clone, use original declaration. 2017-03-13 Martin Liska PR middle-end/78339 * gcc.target/i386/mpx/pr78339.c: New test. From-SVN: r246098 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-pure-const.c | 8 +++++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/mpx/pr78339.c | 5 +++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pr78339.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b00a0cd..a4cd56f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-03-13 Martin Liska + + PR middle-end/78339 + * ipa-pure-const.c (warn_function_noreturn): If the declarations + is a CHKP clone, use original declaration. + 2017-03-13 Claudiu Zissulescu * config/arc/arc.c (arc_init): Use multiplier whenever we have it. diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 3781171..e457166 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/ChangeLog b/gcc/testsuite/ChangeLog index 873f648..a3af805 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-13 Martin Liska + + PR middle-end/78339 + * gcc.target/i386/mpx/pr78339.c: New test. + 2017-03-13 Claudiu Zissulescu * testsuite/gcc.target/arc/bitfield.c: New file. 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 0000000..3dd0424 --- /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.7.4