diff options
author | Jason Merrill <jason@redhat.com> | 2012-10-08 10:45:37 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2012-10-08 10:45:37 -0400 |
commit | 7c424acd9ae0f2a99ee54511c00f78371279a328 (patch) | |
tree | bc70ed3cb42f2f1614f8ad5ac0a05170d55fe604 /libgomp | |
parent | 5b031b9b56c63fbf2a24638e6ccb8da45ce936c1 (diff) | |
download | gcc-7c424acd9ae0f2a99ee54511c00f78371279a328.zip gcc-7c424acd9ae0f2a99ee54511c00f78371279a328.tar.gz gcc-7c424acd9ae0f2a99ee54511c00f78371279a328.tar.bz2 |
Allow dynamic initialization of thread_locals.
gcc/cp/
* decl.c: Define tls_aggregates.
(expand_static_init): Remove sorry. Add to tls_aggregates.
* cp-tree.h: Declare tls_aggregates.
* call.c (set_up_extended_ref_temp): Add to tls_aggregates.
* decl2.c (var_needs_tls_wrapper): New.
(var_defined_without_dynamic_init): New.
(get_tls_init_fn, get_tls_wrapper_fn): New.
(generate_tls_wrapper, handle_tls_init): New.
(cp_write_global_declarations): Call handle_tls_init and
enerate_tls_wrapper.
* mangle.c (write_guarded_var_name): Split out from..
(mangle_guard_variable): ...here.
(mangle_tls_init_fn, mangle_tls_wrapper_fn): Use it.
(decl_tls_wrapper_p): New.
* semantics.c (finish_id_expression): Replace use of thread_local
variable with a call to its wrapper.
libiberty/
* cp-demangle.c (d_special_name, d_dump): Handle TH and TW.
(d_make_comp, d_print_comp): Likewise.
include/
* demangle.h (enum demangle_component_type): Add
DEMANGLE_COMPONENT_TLS_INIT and DEMANGLE_COMPONENT_TLS_WRAPPER.
From-SVN: r192211
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 4 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c++/tls-init1.C | 26 |
2 files changed, 30 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index ce8384d..8ed6abc 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,7 @@ +2012-10-04 Jason Merrill <jason@redhat.com> + + * testsuite/libgomp.c++/tls-init1.C: New. + 2012-09-14 David Edelsohn <dje.gcc@gmail.com> * configure: Regenerated. diff --git a/libgomp/testsuite/libgomp.c++/tls-init1.C b/libgomp/testsuite/libgomp.c++/tls-init1.C new file mode 100644 index 0000000..4cbaccb --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/tls-init1.C @@ -0,0 +1,26 @@ +extern "C" void abort(); + +struct A +{ + A(); + int i; +}; + +extern A a; +#pragma omp threadprivate (a) +A a; + +A &f() +{ + return a; +} + +int j; +A::A(): i(j) { } + +int main() +{ + j = 42; + if (f().i != 42) + abort (); +} |