gcc/libgomp/testsuite/libgomp.c++/target-same-name-2-b.C
Tobias Burnus 1002a7ace1 LTO: Fixes for renaming issues with offload/OpenMP [PR104285]
gcc/lto/ChangeLog:

	PR middle-end/104285
	* lto-partition.cc (maybe_rewrite_identifier): Use get_identifier
	for the returned string to be usable as hash key.
	(validize_symbol_for_target): Hence, use return value directly.
	(privatize_symbol_name_1): Track maybe_rewrite_identifier renames.
	* lto.cc (offload_handle_link_vars): Move function up before ...
	(do_whole_program_analysis): Call it after static renamings.
	(lto_main): Move call after static renamings.

libgomp/ChangeLog:

	PR middle-end/104285
	* testsuite/libgomp.c++/target-same-name-2-a.C: New test.
	* testsuite/libgomp.c++/target-same-name-2-b.C: New test.
	* testsuite/libgomp.c++/target-same-name-2.C: New test.
	* testsuite/libgomp.c-c++-common/target-same-name-1-a.c: New test.
	* testsuite/libgomp.c-c++-common/target-same-name-1-b.c: New test.
	* testsuite/libgomp.c-c++-common/target-same-name-1.c: New test.
2022-03-23 09:44:39 +01:00

50 lines
700 B
C

/* { dg-skip-if "" { *-*-* } } */
/* Used by target-same-name-2.c */
#include <complex>
template<typename T>
int
test_map ()
{
std::complex<T> a(2, 1), a_check;
#pragma omp target map(from : a_check)
{
a_check = a;
}
if (a == a_check)
return 42;
return 0;
}
template<typename T>
static int
test_map_static ()
{
std::complex<T> a(-4, 5), a_check;
#pragma omp target map(from : a_check)
{
a_check = a;
}
if (a == a_check)
return 442;
return 0;
}
int
test_b()
{
int res = test_map<float>();
if (res != 42)
__builtin_abort ();
return res;
}
int
test_b2()
{
int res = test_map_static<float>();
if (res != 442)
__builtin_abort ();
return res;
}