public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-7854] c++: visibility of local extern [PR103291] Date: Mon, 28 Mar 2022 13:37:38 +0000 (GMT) [thread overview] Message-ID: <20220328133738.92B863858C2C@sourceware.org> (raw) https://gcc.gnu.org/g:8796eb27e24bd3340ebd393e96a94b91d09407e9 commit r12-7854-g8796eb27e24bd3340ebd393e96a94b91d09407e9 Author: Jason Merrill <jason@redhat.com> Date: Sun Mar 27 09:44:59 2022 -0400 c++: visibility of local extern [PR103291] When setting up the hidden namespace-scope decl for a local extern, we also need to set its visibility. PR c++/103291 gcc/cp/ChangeLog: * name-lookup.cc (push_local_extern_decl_alias): Call determine_visibility. gcc/testsuite/ChangeLog: * g++.dg/ext/visibility/visibility-local-extern1.C: New test. Diff: --- gcc/cp/name-lookup.cc | 3 +++ gcc/testsuite/g++.dg/ext/visibility/visibility-local-extern1.C | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc index 3c7b626350f..c833b84ca8a 100644 --- a/gcc/cp/name-lookup.cc +++ b/gcc/cp/name-lookup.cc @@ -3476,6 +3476,9 @@ push_local_extern_decl_alias (tree decl) && CP_DECL_THREAD_LOCAL_P (decl) && alias != error_mark_node) set_decl_tls_model (alias, DECL_TLS_MODEL (decl)); + + /* Adjust visibility. */ + determine_visibility (alias); } } diff --git a/gcc/testsuite/g++.dg/ext/visibility/visibility-local-extern1.C b/gcc/testsuite/g++.dg/ext/visibility/visibility-local-extern1.C new file mode 100644 index 00000000000..40c20199d0c --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/visibility/visibility-local-extern1.C @@ -0,0 +1,10 @@ +// PR c++/103291 +// { dg-additional-options -fpic } +// { dg-final { scan-assembler-not "@GOTPCREL" } } + +#pragma GCC visibility push(hidden) + +int hidden_fetch(void) { + extern const int hidden_global; + return hidden_global; +}
reply other threads:[~2022-03-28 13:37 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220328133738.92B863858C2C@sourceware.org \ --to=jason@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).