summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c++/cancel-for-1.C
blob: 8183a2d06a1e6bc1d04772179ef8f17f90d0377a (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
29
// { dg-do run }
// { dg-set-target-env-var OMP_CANCELLATION "true" }

#include <omp.h>
#include "cancel-test.h"

int
main ()
{
  {
    S c;
    #pragma omp parallel num_threads (32)
    {
      S a, b;
      int i;
      #pragma omp for private (b) firstprivate (c)
      for (i = 0; i < 1000; ++i)
	{
	  S d;
	  #pragma omp cancel for
	  if (omp_get_cancellation ())
	    abort ();
	  b.bump ();
	  c.bump ();
	}
    }
  }
  S::verify ();
}