gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/structured-detach-underflow.c
Julian Brown 25bce75c77 openacc: Remove unnecessary detach finalization
The call to gomp_detach_pointer in gomp_unmap_vars_internal does not
need to force finalization, and doing so may mask mismatched pointer
attachments/detachments. This patch removes the forcing.

2020-07-16  Julian Brown  <julian@codesourcery.com>
	    Thomas Schwinge  <thomas@codesourcery.com>

libgomp/
	* target.c (gomp_unmap_vars_internal): Remove unnecessary forcing of
	finalization for detach operation.
	* testsuite/libgomp.oacc-c-c++-common/structured-detach-underflow.c:
	New test.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
2020-07-23 12:50:07 -07:00

29 lines
634 B
C

/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <stdio.h>
int main ()
{
struct {
int *arr;
} mystr;
int localarr[16];
mystr.arr = localarr;
#pragma acc enter data copyin(mystr, localarr[0:16])
#pragma acc data attach(mystr.arr)
{
#pragma acc exit data detach(mystr.arr)
fprintf (stderr, "CheCKpOInT1\n");
/* { dg-output ".*CheCKpOInT1(\n|\r\n|\r)" } */
}
/* { dg-shouldfail "" }
{ dg-output "(\n|\r\n|\r)libgomp: attach count underflow(\n|\r\n|\r)$" } */
fprintf (stderr, "CheCKpOInT2\n");
#pragma acc exit data copyout(mystr, localarr[0:16])
return 0;
}