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

46 lines
1.1 KiB
C

/* { dg-additional-sources "target-same-name-1-a.c target-same-name-1-b.c" } */
/* PR middle-end/104285 */
/* Both files create the same static symbol, which caused issues
in non-host lto1. */
int one ();
int two ();
int one_get_inc2_local_link ();
int two_get_inc4_local_link ();
int one_get_inc3_link_a ();
int two_get_inc5_link_a ();
int
main ()
{
if (one () != 5)
__builtin_abort ();
if (two () != 7)
__builtin_abort ();
if (one_get_inc2_local_link () != 42)
__builtin_abort ();
if (two_get_inc4_local_link () != 55)
__builtin_abort ();
if (one_get_inc2_local_link () != 42+2)
__builtin_abort ();
if (two_get_inc4_local_link () != 55+4)
__builtin_abort ();
if (one_get_inc3_link_a () != 123)
__builtin_abort ();
if (two_get_inc5_link_a () != 123+3)
__builtin_abort ();
/* FIXME: The last call did not increment the global var. */
/* PR middle-end/105015 */
#if 0
if (one_get_inc3_link_a () != 123+3+5)
__builtin_abort ();
if (two_get_inc5_link_a () != 123+3+5+3)
__builtin_abort ();
#endif
return 0;
}