aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/gomp/imperfect2.c
blob: dff17dd3ca52457b6544b4608d5d8100e54eb75c (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
30
31
32
33
34
/* { dg-do compile } */

/* This test case is expected to fail due to errors.  */

/* These functions that are part of the OpenMP runtime API would ordinarily
   be declared in omp.h, but we don't have that here.  */
extern int omp_get_num_threads(void);
extern int omp_get_max_threads(void);

int f1 (int depth, int iter);
int f2 (int depth, int iter);

void s1 (int a1, int a2, int a3)
{
  int i, j, k;
#pragma omp for collapse(3)
  for (i = 0; i < a1; i++)
    {
      f1 (0, i);
      for (j = 0; j < omp_get_num_threads (); j++)  /* This is OK */
	{
	  f1 (1, omp_get_num_threads ());  /* { dg-error "not permitted in intervening code" } */
	  for (k = omp_get_num_threads (); k < a3; k++)  /* This is OK */
	    {
	      f1 (2, omp_get_num_threads ());
	      f2 (2, omp_get_max_threads ());
	    }
	  f2 (1, omp_get_max_threads ());  /* { dg-error "not permitted in intervening code" } */
	}
      f2 (0, i);
    }
}