gcc/libgomp/testsuite/libgomp.c++/pr24455.C
Jason Merrill 5af057d8bd re PR target/54908 (misc regressions on emutls targets remain from dynamic initialization of non-function-local TLS variables)
PR target/54908
c-family/
	* c.opt (-fextern-tls-init): New.
	* c-opts.c (c_common_post_options): Handle it.
cp/
	* decl2.c (get_local_tls_init_fn): New.
	(get_tls_init_fn): Handle flag_extern_tls_init.  Don't bother
	with aliases for internal variables.  Don't use weakrefs if
	the variable needs destruction.
	(generate_tls_wrapper): Mark the wrapper as const if no
	initialization is needed.
	(handle_tls_init): Don't require aliases.

From-SVN: r195310
2013-01-19 00:25:25 -05:00

25 lines
395 B
C

// { dg-do run }
// { dg-additional-sources pr24455-1.C }
// { dg-require-effective-target tls_runtime }
// { dg-options "-fno-extern-tls-init" }
extern "C" void abort (void);
extern int i;
#pragma omp threadprivate(i)
int main()
{
i = 0;
#pragma omp parallel default(none) num_threads(10) copyin(i)
{
i++;
#pragma omp barrier
if (i != 1)
abort ();
}
return 0;
}