public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-8487] function: Set dummy DECL_ASSEMBLER_NAME in push_dummy_function [PR100580]
@ 2021-05-31 14:08 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2021-05-31 14:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c4d64d136e4e35fb2ee90771848944bb2ffeaf85

commit r11-8487-gc4d64d136e4e35fb2ee90771848944bb2ffeaf85
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue May 18 10:10:17 2021 +0200

    function: Set dummy DECL_ASSEMBLER_NAME in push_dummy_function [PR100580]
    
    Last year I've added cgraph_node::get_create calls for the dummy
    functions used for -fdump-passes, so that it interacts well with pass
    disabling/enabling which is cgraph uid based.
    Unfortunately, as the following testcase shows, when assembler hash
    is present, that wants to compute DECL_ASSEMBLER_NAME and the C++ FE
    is unprepared to handle it on the dummy functions which don't have
    DECL_NAME etc.
    The following patch fixes it by setting up a dummy DECL_ASSEMBLER_NAME
    on these, so that the FEs don't need to compute it.
    
    2021-05-18  Jakub Jelinek  <jakub@redhat.com>
    
            PR c++/100580
            * function.c (push_dummy_function): Set DECL_ARTIFICIAL and
            DECL_ASSEMBLER_NAME on the fn_decl.
    
            * g++.dg/other/pr100580.C: New test.
    
    (cherry picked from commit 978b62e554ffb4b34844c72d259ce71fcbd87591)

Diff:
---
 gcc/function.c                        | 3 +++
 gcc/testsuite/g++.dg/other/pr100580.C | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/gcc/function.c b/gcc/function.c
index a3ed3987b95..fc7b147b5f1 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4930,6 +4930,9 @@ push_dummy_function (bool with_decl)
       fn_result_decl = build_decl (UNKNOWN_LOCATION, RESULT_DECL,
 					 NULL_TREE, void_type_node);
       DECL_RESULT (fn_decl) = fn_result_decl;
+      DECL_ARTIFICIAL (fn_decl) = 1;
+      tree fn_name = get_identifier (" ");
+      SET_DECL_ASSEMBLER_NAME (fn_decl, fn_name);
     }
   else
     fn_decl = NULL_TREE;
diff --git a/gcc/testsuite/g++.dg/other/pr100580.C b/gcc/testsuite/g++.dg/other/pr100580.C
new file mode 100644
index 00000000000..d6cc0a6dc61
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/pr100580.C
@@ -0,0 +1,8 @@
+// PR c++/100580
+// { dg-do compile }
+// { dg-require-weak "" }
+// { dg-options "-fdump-passes" }
+// { dg-prune-output ".*" }
+
+int foo;
+static __typeof(foo) bar __attribute__((__weakref__("foo")));


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-31 14:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31 14:08 [gcc r11-8487] function: Set dummy DECL_ASSEMBLER_NAME in push_dummy_function [PR100580] Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).