gcc/libgomp/testsuite/libgomp.c-c++-common/target-same-name-1-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

61 lines
956 B
C

/* { dg-skip-if "" { *-*-* } } */
/* Used by target-same-name-1.c */
static int local_link = 55;
#pragma omp declare target link(local_link)
extern int decl_a_link;
#pragma omp declare target link(decl_a_link)
#pragma omp declare target
static int __attribute__ ((noinline,noclone))
foo ()
{
return 7;
}
#pragma omp end declare target
static int __attribute__ ((noinline,noclone))
bar ()
{
int i;
#pragma omp target map(from:i)
i = foo ();
return i;
}
int
two () {
return bar ();
}
int
two_get_inc4_local_link ()
{
int res, res2;
#pragma omp target map(from: res, res2)
{
res = local_link;
local_link += 4;
res2 = local_link;
}
if (res + 4 != res2)
__builtin_abort ();
return res;
}
int
two_get_inc5_link_a ()
{
int res, res2;
#pragma omp target map(from: res, res2)
{
res = decl_a_link;
decl_a_link += 5;
res2 = decl_a_link;
}
if (res + 5 != res2)
__builtin_abort ();
return res;
}