aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.oacc-c-c++-common/structured-detach-underflow.c
blob: fc1f59e2185d28fd610d31e58a900469f93bb169 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* { 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;
}