-
- Downloads
c++: Support thread_local statics in header modules [PR113292]
Currently, thread_locals in header modules cause ICEs. This patch makes
the required changes for them to work successfully.
This requires additionally writing the DECL_TLS_MODEL for thread-local
variables to the module interface, and the TLS wrapper function needs to
have its DECL_BEFRIENDING_CLASSES written too as this is used to
retrieve what VAR_DECL it's a wrapper for when emitting a definition at
end of TU processing.
PR c++/113292
gcc/cp/ChangeLog:
* decl2.cc (get_tls_wrapper_fn): Set DECL_CONTEXT.
(c_parse_final_cleanups): Suppress warning for no definition of
TLS wrapper functions in header modules.
* module.cc (trees_out::lang_decl_vals): Write wrapped variable
for TLS wrapper functions.
(trees_in::lang_decl_vals): Read it.
(trees_out::decl_value): Write TLS model for thread-local vars.
(trees_in::decl_value): Read it for new decls. Remember to emit
definitions of TLS wrapper functions later.
gcc/testsuite/ChangeLog:
* g++.dg/modules/pr113292_a.H: New test.
* g++.dg/modules/pr113292_b.C: New test.
* g++.dg/modules/pr113292_c.C: New test.
Signed-off-by:
Nathaniel Shead <nathanieloshead@gmail.com>
Showing
- gcc/cp/decl2.cc 6 additions, 4 deletionsgcc/cp/decl2.cc
- gcc/cp/module.cc 22 additions, 0 deletionsgcc/cp/module.cc
- gcc/testsuite/g++.dg/modules/pr113292_a.H 34 additions, 0 deletionsgcc/testsuite/g++.dg/modules/pr113292_a.H
- gcc/testsuite/g++.dg/modules/pr113292_b.C 13 additions, 0 deletionsgcc/testsuite/g++.dg/modules/pr113292_b.C
- gcc/testsuite/g++.dg/modules/pr113292_c.C 11 additions, 0 deletionsgcc/testsuite/g++.dg/modules/pr113292_c.C
Loading
Please register or sign in to comment