public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103291] New: gcc 11 regression with #pragma GCC visibility vs extern inside C++ functions
@ 2021-11-16 22:01 roland at gnu dot org
2021-11-16 22:13 ` [Bug c++/103291] [11/12 Regression] visibility is lost for external decls declared inside a function pinskia at gcc dot gnu.org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: roland at gnu dot org @ 2021-11-16 22:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103291
Bug ID: 103291
Summary: gcc 11 regression with #pragma GCC visibility vs
extern inside C++ functions
Product: gcc
Version: 11.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: roland at gnu dot org
Target Milestone: ---
GCC 11 has a regression with:
```
#pragma GCC visibility push(hidden)
int hidden_fetch(void) {
extern const int hidden_global;
return hidden_global;
}
```
when compiled with -fpic. GCC 10 would always avoid the GOT for this case. GCC
11 avoids the GOT when it's compiled as C, but uses the GOT when it's compiled
as C++. Moving the extern decl outside the function makes it dtrt again in C++
as well.
Reproduced on trunk at 4cdf7db9a39d18bd536d816a5751d4d3cf23808b and on 11
branch at b52e2254b30445f3cd667ae0f0d99b183394e37b.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/103291] [11/12 Regression] visibility is lost for external decls declared inside a function
2021-11-16 22:01 [Bug c++/103291] New: gcc 11 regression with #pragma GCC visibility vs extern inside C++ functions roland at gnu dot org
@ 2021-11-16 22:13 ` pinskia at gcc dot gnu.org
2021-11-16 22:15 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-16 22:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103291
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |10.3.0
Summary|gcc 11 regression with |[11/12 Regression]
|#pragma GCC visibility vs |visibility is lost for
|extern inside C++ functions |external decls declared
| |inside a function
Target Milestone|--- |11.3
Known to fail| |11.1.0, 12.0
Keywords| |missed-optimization
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/103291] [11/12 Regression] visibility is lost for external decls declared inside a function
2021-11-16 22:01 [Bug c++/103291] New: gcc 11 regression with #pragma GCC visibility vs extern inside C++ functions roland at gnu dot org
2021-11-16 22:13 ` [Bug c++/103291] [11/12 Regression] visibility is lost for external decls declared inside a function pinskia at gcc dot gnu.org
@ 2021-11-16 22:15 ` pinskia at gcc dot gnu.org
2021-11-16 22:19 ` [Bug c++/103291] [11/12 Regression] #pragma gcc " pinskia at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-16 22:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103291
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2021-11-16
Status|UNCONFIRMED |NEW
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=102496
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Related to PR 102496 (which was about losing __thread).
Confirmed.
Most likely introduced by the same commit too (r11-3699-g4e62aca0e0).
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/103291] [11/12 Regression] #pragma gcc visibility is lost for external decls declared inside a function
2021-11-16 22:01 [Bug c++/103291] New: gcc 11 regression with #pragma GCC visibility vs extern inside C++ functions roland at gnu dot org
2021-11-16 22:13 ` [Bug c++/103291] [11/12 Regression] visibility is lost for external decls declared inside a function pinskia at gcc dot gnu.org
2021-11-16 22:15 ` pinskia at gcc dot gnu.org
@ 2021-11-16 22:19 ` pinskia at gcc dot gnu.org
2021-11-16 22:24 ` mpolacek at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-16 22:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103291
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[11/12 Regression] |[11/12 Regression] #pragma
|visibility is lost for |gcc visibility is lost for
|external decls declared |external decls declared
|inside a function |inside a function
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The attribute still works.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/103291] [11/12 Regression] #pragma gcc visibility is lost for external decls declared inside a function
2021-11-16 22:01 [Bug c++/103291] New: gcc 11 regression with #pragma GCC visibility vs extern inside C++ functions roland at gnu dot org
` (2 preceding siblings ...)
2021-11-16 22:19 ` [Bug c++/103291] [11/12 Regression] #pragma gcc " pinskia at gcc dot gnu.org
@ 2021-11-16 22:24 ` mpolacek at gcc dot gnu.org
2021-11-18 7:41 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-11-16 22:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103291
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> Most likely introduced by the same commit too (r11-3699-g4e62aca0e0).
Yes. r11-3698:
_Z12hidden_fetchv:
.LFB0:
pushq %rbp
.LCFI0:
movq %rsp, %rbp
.LCFI1:
movl hidden_global(%rip), %eax
popq %rbp
.LCFI2:
ret
r11-3699:
_Z12hidden_fetchv:
.LFB0:
pushq %rbp
.LCFI0:
movq %rsp, %rbp
.LCFI1:
movq hidden_global@GOTPCREL(%rip), %rax
movl (%rax), %eax
popq %rbp
.LCFI2:
ret
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/103291] [11/12 Regression] #pragma gcc visibility is lost for external decls declared inside a function
2021-11-16 22:01 [Bug c++/103291] New: gcc 11 regression with #pragma GCC visibility vs extern inside C++ functions roland at gnu dot org
` (3 preceding siblings ...)
2021-11-16 22:24 ` mpolacek at gcc dot gnu.org
@ 2021-11-18 7:41 ` rguenth at gcc dot gnu.org
2021-11-18 9:46 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-18 7:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103291
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/103291] [11/12 Regression] #pragma gcc visibility is lost for external decls declared inside a function
2021-11-16 22:01 [Bug c++/103291] New: gcc 11 regression with #pragma GCC visibility vs extern inside C++ functions roland at gnu dot org
` (4 preceding siblings ...)
2021-11-18 7:41 ` rguenth at gcc dot gnu.org
@ 2021-11-18 9:46 ` jakub at gcc dot gnu.org
2022-03-27 13:38 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-11-18 9:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103291
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Perhaps determine_visibility could recurse on DECL_LOCAL_DECL_ALIAS if non-NULL
and perhaps DECL_VISIBILITY (decl) != orig_visibility
|| DECL_VISIBILITY_SPECIFIED (decl) != orig_visibility_specified
? Though, not really sure what should be done if one does e.g.:
int non_hidden_fetch(void) {
extern const int hidden_global;
return hidden_global;
}
#pragma GCC visibility push(hidden)
int hidden_fetch(void) {
extern const int hidden_global;
return hidden_global;
}
etc.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/103291] [11/12 Regression] #pragma gcc visibility is lost for external decls declared inside a function
2021-11-16 22:01 [Bug c++/103291] New: gcc 11 regression with #pragma GCC visibility vs extern inside C++ functions roland at gnu dot org
` (5 preceding siblings ...)
2021-11-18 9:46 ` jakub at gcc dot gnu.org
@ 2022-03-27 13:38 ` jason at gcc dot gnu.org
2022-03-28 13:37 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2022-03-27 13:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103291
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
CC| |jason at gcc dot gnu.org
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/103291] [11/12 Regression] #pragma gcc visibility is lost for external decls declared inside a function
2021-11-16 22:01 [Bug c++/103291] New: gcc 11 regression with #pragma GCC visibility vs extern inside C++ functions roland at gnu dot org
` (6 preceding siblings ...)
2022-03-27 13:38 ` jason at gcc dot gnu.org
@ 2022-03-28 13:37 ` cvs-commit at gcc dot gnu.org
2022-03-28 19:12 ` [Bug c++/103291] [11 " cvs-commit at gcc dot gnu.org
2022-03-28 19:19 ` jason at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-28 13:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103291
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/103291] [11 Regression] #pragma gcc visibility is lost for external decls declared inside a function
2021-11-16 22:01 [Bug c++/103291] New: gcc 11 regression with #pragma GCC visibility vs extern inside C++ functions roland at gnu dot org
` (7 preceding siblings ...)
2022-03-28 13:37 ` cvs-commit at gcc dot gnu.org
@ 2022-03-28 19:12 ` cvs-commit at gcc dot gnu.org
2022-03-28 19:19 ` jason at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-28 19:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103291
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:10dcd13ff7a9f0fbbae8749929e8808792c76395
commit r11-9702-g10dcd13ff7a9f0fbbae8749929e8808792c76395
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.c (push_local_extern_decl_alias): Call
determine_visibility.
gcc/testsuite/ChangeLog:
* g++.dg/ext/visibility/visibility-local-extern1.C: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/103291] [11 Regression] #pragma gcc visibility is lost for external decls declared inside a function
2021-11-16 22:01 [Bug c++/103291] New: gcc 11 regression with #pragma GCC visibility vs extern inside C++ functions roland at gnu dot org
` (8 preceding siblings ...)
2022-03-28 19:12 ` [Bug c++/103291] [11 " cvs-commit at gcc dot gnu.org
@ 2022-03-28 19:19 ` jason at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2022-03-28 19:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103291
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-03-28 19:19 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 22:01 [Bug c++/103291] New: gcc 11 regression with #pragma GCC visibility vs extern inside C++ functions roland at gnu dot org
2021-11-16 22:13 ` [Bug c++/103291] [11/12 Regression] visibility is lost for external decls declared inside a function pinskia at gcc dot gnu.org
2021-11-16 22:15 ` pinskia at gcc dot gnu.org
2021-11-16 22:19 ` [Bug c++/103291] [11/12 Regression] #pragma gcc " pinskia at gcc dot gnu.org
2021-11-16 22:24 ` mpolacek at gcc dot gnu.org
2021-11-18 7:41 ` rguenth at gcc dot gnu.org
2021-11-18 9:46 ` jakub at gcc dot gnu.org
2022-03-27 13:38 ` jason at gcc dot gnu.org
2022-03-28 13:37 ` cvs-commit at gcc dot gnu.org
2022-03-28 19:12 ` [Bug c++/103291] [11 " cvs-commit at gcc dot gnu.org
2022-03-28 19:19 ` jason at gcc dot gnu.org
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).