aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/gomp/scan-7.c
blob: 412c98d5ee0601f7f2921fbe8ce829dedf5a6aff (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
int a;

void
foo (int *c, int *d)
{
  #pragma omp for reduction (inscan, +: a) /* { dg-error "'a' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" } */
  #pragma omp tile sizes (2)
  for (int i = 0; i < 64; ++i)
    {
      a = a + c[i];
      #pragma omp scan inclusive (a) /* { dg-error "'#pragma omp scan' may only be used in a loop construct with 'inscan' 'reduction' clause" } */
      d[i] = a;
    }
}

void
bar (int **c, int **d)
{
  #pragma omp for collapse (2) reduction (inscan, +: a) /* { dg-error "'a' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" } */
  for (int i = 0; i < 64; ++i)
    #pragma omp tile sizes (3)
    for (int j = 0; j < 64; ++j)
      {
	d[i][j] = a;
	#pragma omp scan exclusive (a) /* { dg-error "'#pragma omp scan' may only be used in a loop construct with 'inscan' 'reduction' clause" } */
	a = a + c[i][j];
      }
}

void
baz (int *c, int *d)
{
  #pragma omp for reduction (inscan, +: a) /* { dg-error "'a' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" } */
  #pragma omp unroll partial (2)
  for (int i = 0; i < 64; ++i)
    {
      d[i] = a;
      #pragma omp scan exclusive (a) /* { dg-error "'#pragma omp scan' may only be used in a loop construct with 'inscan' 'reduction' clause" } */
      a = a + c[i];
    }
}

void
qux (int **c, int **d)
{
  #pragma omp for collapse (2) reduction (inscan, +: a) /* { dg-error "'a' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" } */
  for (int i = 0; i < 64; ++i)
    #pragma omp unroll partial (3)
    for (int j = 0; j < 64; ++j)
      {
	a = a + c[i][j];
	#pragma omp scan inclusive (a) /* { dg-error "'#pragma omp scan' may only be used in a loop construct with 'inscan' 'reduction' clause" } */
	d[i][j] = a;
      }
}