gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-1.c
Thomas Schwinge 3d1b5e710e [PR92854] Add 'libgomp.oacc-c-c++-common/acc_map_data-device_already-*.c', 'libgomp.oacc-c-c++-common/acc_map_data-host_already-*.c'
... to document the status quo.

	libgomp/
	PR libgomp/92854
	* testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-1.c:
	New file.
	* testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-3.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-1.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-3.c:
	Likewise.

From-SVN: r279231
2019-12-11 17:48:59 +01:00

37 lines
900 B
C

/* Verify that we refuse 'acc_map_data' when the "device address [...] is
already mapped". */
/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <openacc.h>
int
main ()
{
const int N = 131;
char *h1 = (char *) malloc (N);
assert (h1);
void *d = acc_malloc (N);
assert (d);
acc_map_data (h1, d, N);
char *h2 = (char *) malloc (N);
assert (h2);
/* Try to arrange a setting such that a later 'acc_unmap_data' would find the
device memory object still referenced elsewhere. This is not possible,
given the semantics of 'acc_map_data'. */
fprintf (stderr, "CheCKpOInT\n");
acc_map_data (h2, d, N);
return 0;
}
/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
/* { dg-output "device address \\\[\[0-9a-fA-FxX\]+, \\\+131\\\] is already mapped" } */
/* { dg-shouldfail "" } */