aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/gomp/imperfect1.c
blob: 705626ad169e12deb4454519ecb060ed96ae805d (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
35
36
37
38
/* { dg-do compile } */

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

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 < a2; j++)
	{
#pragma omp barrier	/* { dg-error "intervening code must not contain OpenMP directives" } */
	  f1 (1, j);
	  if (i == 2)
	    continue;	/* { dg-error "invalid exit" } */
	  else
	    break;	/* { dg-error "invalid exit" } */
	  for (k = 0; k < a3; k++)
	    {
	      f1 (2, k);
	      f2 (2, k);
	    }
	  f2 (1, j);
	}
      for (k = 0; k < a3; k++)	/* { dg-error "loop not permitted in intervening code " } */
	{
	  f1 (2, k);
	  f2 (2, k);
	}
      f2 (0, i);
    }
}