gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-14.c
Thomas Schwinge cec41816c1 [PR92503] [OpenACC] Don't silently 'acc_unmap_data' in 'acc_free'
libgomp/
	PR libgomp/92503
	* oacc-mem.c (acc_free): Error out instead of 'acc_unmap_data'.
	* testsuite/libgomp.oacc-c-c++-common/acc_free-pr92503-1.c: New
	file.
	* testsuite/libgomp.oacc-c-c++-common/acc_free-pr92503-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_free-pr92503-3-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_free-pr92503-3.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_free-pr92503-4-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_free-pr92503-4.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Adjust.
	* testsuite/libgomp.oacc-c-c++-common/context-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/context-2.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/context-3.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/context-4.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/lib-91.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise.

From-SVN: r279146
2019-12-09 23:52:47 +01:00

64 lines
915 B
C

/* Check acc_is_present. */
/* { dg-do run { target openacc_nvidia_accel_selected } } */
#include <stdlib.h>
#include <openacc.h>
#include <stdio.h>
int
main (int argc, char **argv)
{
const int N = 256;
int i;
unsigned char *h;
void *d;
h = (unsigned char *) malloc (N);
for (i = 0; i < N; i++)
{
h[i] = i;
}
d = acc_copyin (h, N);
if (acc_is_present (h, 1) != 1)
abort ();
if (acc_is_present (h + N - 1, 1) != 1)
abort ();
if (acc_is_present (h - 1, 1) != 0)
abort ();
if (acc_is_present (h + N, 1) != 0)
abort ();
for (i = 0; i < N; i++)
{
if (acc_is_present (h + i, 1) != 1)
abort ();
}
for (i = 0; i < N; i++)
{
if (acc_is_present (h + i, N - i) != 1)
abort ();
}
acc_delete (h, N);
for (i = 0; i < N; i++)
{
if (acc_is_present (h + i, N - i) != 0)
abort ();
}
free (h);
return 0;
}