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

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).