This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Handle noipa attribute in IPA visibility (PR ipa/83594).
- From: Martin Liška <mliska at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Jakub Jelinek <jakub at redhat dot com>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Wed, 27 Dec 2017 15:14:21 +0100
- Subject: [PATCH] Handle noipa attribute in IPA visibility (PR ipa/83594).
- Authentication-results: sourceware.org; auth=none
Hi.
As we introduced noipa attribute, I believe proper fix to not to crash
is to ignore all functions with the attribute in iteration of IPA visibility
pass.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
Ready to be installed?
Martin
gcc/ChangeLog:
2017-12-27 Martin Liska <mliska@suse.cz>
PR ipa/83594
* ipa-visibility.c (function_and_variable_visibility): Skip
functions with noipa attribure.
gcc/testsuite/ChangeLog:
2017-12-27 Martin Liska <mliska@suse.cz>
PR ipa/83594
* gcc.dg/ipa/pr83594.c: New test.
---
gcc/ipa-visibility.c | 3 ++-
gcc/testsuite/gcc.dg/ipa/pr83594.c | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.dg/ipa/pr83594.c
diff --git a/gcc/ipa-visibility.c b/gcc/ipa-visibility.c
index b6bc870b11d..9f136d9069c 100644
--- a/gcc/ipa-visibility.c
+++ b/gcc/ipa-visibility.c
@@ -623,7 +623,8 @@ function_and_variable_visibility (bool whole_program)
{
if (node->get_availability () != AVAIL_INTERPOSABLE
|| DECL_EXTERNAL (node->decl)
- || node->has_aliases_p ())
+ || node->has_aliases_p ()
+ || lookup_attribute ("noipa", DECL_ATTRIBUTES (node->decl)))
continue;
cgraph_node *alias = 0;
diff --git a/gcc/testsuite/gcc.dg/ipa/pr83594.c b/gcc/testsuite/gcc.dg/ipa/pr83594.c
new file mode 100644
index 00000000000..1927c636ec0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr83594.c
@@ -0,0 +1,5 @@
+__attribute__((noipa))
+void foo ()
+{
+ foo ();
+}