* [Bug c++/102496] [11/12 regression] extern __thread declaration in function scope produces a non-TLS reference
2021-09-27 10:37 [Bug c++/102496] New: [11 regression] extern __thread declaration in function scope produces a non-TLS reference jlegg at feralinteractive dot com
@ 2021-09-27 10:43 ` pinskia at gcc dot gnu.org
2021-09-27 10:52 ` [Bug c++/102496] [11/12 regression] extern __thread and thread_local " pinskia at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-27 10:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102496
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Known to fail| |11.1.0
Last reconfirmed| |2021-09-27
Summary|[11 regression] extern |[11/12 regression] extern
|__thread declaration in |__thread declaration in
|function scope produces a |function scope produces a
|non-TLS reference |non-TLS reference
Keywords| |link-failure, wrong-code
Target Milestone|--- |11.3
Known to work| |10.3.0
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/102496] [11/12 regression] extern __thread and thread_local declaration in function scope produces a non-TLS reference
2021-09-27 10:37 [Bug c++/102496] New: [11 regression] extern __thread declaration in function scope produces a non-TLS reference jlegg at feralinteractive dot com
2021-09-27 10:43 ` [Bug c++/102496] [11/12 " pinskia at gcc dot gnu.org
@ 2021-09-27 10:52 ` pinskia at gcc dot gnu.org
2021-09-28 8:32 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-27 10:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102496
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[11/12 regression] extern |[11/12 regression] extern
|__thread declaration in |__thread and thread_local
|function scope produces a |declaration in function
|non-TLS reference |scope produces a non-TLS
| |reference
Severity|normal |major
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is also broken for thread_local too:
struct a
{
operator int();
};
int main()
{
extern thread_local a thing;
return thing;
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/102496] [11/12 regression] extern __thread and thread_local declaration in function scope produces a non-TLS reference
2021-09-27 10:37 [Bug c++/102496] New: [11 regression] extern __thread declaration in function scope produces a non-TLS reference jlegg at feralinteractive dot com
2021-09-27 10:43 ` [Bug c++/102496] [11/12 " pinskia at gcc dot gnu.org
2021-09-27 10:52 ` [Bug c++/102496] [11/12 regression] extern __thread and thread_local " pinskia at gcc dot gnu.org
@ 2021-09-28 8:32 ` rguenth at gcc dot gnu.org
2021-09-28 14:31 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-09-28 8:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102496
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/102496] [11/12 regression] extern __thread and thread_local declaration in function scope produces a non-TLS reference
2021-09-27 10:37 [Bug c++/102496] New: [11 regression] extern __thread declaration in function scope produces a non-TLS reference jlegg at feralinteractive dot com
` (2 preceding siblings ...)
2021-09-28 8:32 ` rguenth at gcc dot gnu.org
@ 2021-09-28 14:31 ` jakub at gcc dot gnu.org
2021-09-28 14:38 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-09-28 14:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102496
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 51516
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51516&action=edit
gcc12-pr102496.patch
Untested fix.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/102496] [11/12 regression] extern __thread and thread_local declaration in function scope produces a non-TLS reference
2021-09-27 10:37 [Bug c++/102496] New: [11 regression] extern __thread declaration in function scope produces a non-TLS reference jlegg at feralinteractive dot com
` (3 preceding siblings ...)
2021-09-28 14:31 ` jakub at gcc dot gnu.org
@ 2021-09-28 14:38 ` jakub at gcc dot gnu.org
2021-10-01 8:31 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-09-28 14:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102496
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r11-3699-g4e62aca0e0520e4ed2532f2d8153581190621c1a
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/102496] [11/12 regression] extern __thread and thread_local declaration in function scope produces a non-TLS reference
2021-09-27 10:37 [Bug c++/102496] New: [11 regression] extern __thread declaration in function scope produces a non-TLS reference jlegg at feralinteractive dot com
` (4 preceding siblings ...)
2021-09-28 14:38 ` jakub at gcc dot gnu.org
@ 2021-10-01 8:31 ` cvs-commit at gcc dot gnu.org
2021-10-01 12:39 ` [Bug c++/102496] [11 " jakub at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-01 8:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102496
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:701075864ac4d1c6cec936d10f9cfc2aeb8c1699
commit r12-4032-g701075864ac4d1c6cec936d10f9cfc2aeb8c1699
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Oct 1 10:30:16 2021 +0200
c++: Fix handling of __thread/thread_local extern vars declared at function
scope [PR102496]
The introduction of push_local_extern_decl_alias in
r11-3699-g4e62aca0e0520e4ed2532f2d8153581190621c1a
broke tls vars, while the decl they are created for has the tls model
set properly, nothing sets it for the alias that is actually used,
so accesses to it are done as if they were normal variables.
This is then diagnosed at link time if the definition of the extern
vars is __thread/thread_local.
2021-10-01 Jakub Jelinek <jakub@redhat.com>
PR c++/102496
* name-lookup.c (push_local_extern_decl_alias): Return early even
for
tls vars with non-dependent type when processing_template_decl.
For
CP_DECL_THREAD_LOCAL_P vars call set_decl_tls_model on alias.
* g++.dg/tls/pr102496-1.C: New test.
* g++.dg/tls/pr102496-2.C: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/102496] [11 regression] extern __thread and thread_local declaration in function scope produces a non-TLS reference
2021-09-27 10:37 [Bug c++/102496] New: [11 regression] extern __thread declaration in function scope produces a non-TLS reference jlegg at feralinteractive dot com
` (5 preceding siblings ...)
2021-10-01 8:31 ` cvs-commit at gcc dot gnu.org
@ 2021-10-01 12:39 ` jakub at gcc dot gnu.org
2021-10-05 20:30 ` cvs-commit at gcc dot gnu.org
2021-10-12 9:55 ` jakub at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-10-01 12:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102496
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[11/12 regression] extern |[11 regression] extern
|__thread and thread_local |__thread and thread_local
|declaration in function |declaration in function
|scope produces a non-TLS |scope produces a non-TLS
|reference |reference
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/102496] [11 regression] extern __thread and thread_local declaration in function scope produces a non-TLS reference
2021-09-27 10:37 [Bug c++/102496] New: [11 regression] extern __thread declaration in function scope produces a non-TLS reference jlegg at feralinteractive dot com
` (6 preceding siblings ...)
2021-10-01 12:39 ` [Bug c++/102496] [11 " jakub at gcc dot gnu.org
@ 2021-10-05 20:30 ` cvs-commit at gcc dot gnu.org
2021-10-12 9:55 ` jakub at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-05 20:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102496
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:5fec46a0b4a94190209c81f4091a0369a056727d
commit r11-9073-g5fec46a0b4a94190209c81f4091a0369a056727d
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Oct 1 10:30:16 2021 +0200
c++: Fix handling of __thread/thread_local extern vars declared at function
scope [PR102496]
The introduction of push_local_extern_decl_alias in
r11-3699-g4e62aca0e0520e4ed2532f2d8153581190621c1a
broke tls vars, while the decl they are created for has the tls model
set properly, nothing sets it for the alias that is actually used,
so accesses to it are done as if they were normal variables.
This is then diagnosed at link time if the definition of the extern
vars is __thread/thread_local.
2021-10-01 Jakub Jelinek <jakub@redhat.com>
PR c++/102496
* name-lookup.c (push_local_extern_decl_alias): Return early even
for
tls vars with non-dependent type when processing_template_decl.
For
CP_DECL_THREAD_LOCAL_P vars call set_decl_tls_model on alias.
* g++.dg/tls/pr102496-1.C: New test.
* g++.dg/tls/pr102496-2.C: New test.
(cherry picked from commit 701075864ac4d1c6cec936d10f9cfc2aeb8c1699)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/102496] [11 regression] extern __thread and thread_local declaration in function scope produces a non-TLS reference
2021-09-27 10:37 [Bug c++/102496] New: [11 regression] extern __thread declaration in function scope produces a non-TLS reference jlegg at feralinteractive dot com
` (7 preceding siblings ...)
2021-10-05 20:30 ` cvs-commit at gcc dot gnu.org
@ 2021-10-12 9:55 ` jakub at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-10-12 9:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102496
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 11.3+.
^ permalink raw reply [flat|nested] 10+ messages in thread