xref: /llvm-project/flang/test/Semantics/OpenMP/do-collapse.f90 (revision b3403100673dbc61ed26b5500ed74106bca908d3)
1!RUN: %python %S/../test_errors.py %s %flang -fopenmp
2! OpenMP Version 4.5
3! 2.7.1 Collapse Clause
4program omp_doCollapse
5  integer:: i,j
6  !ERROR: The value of the parameter in the COLLAPSE or ORDERED clause must not be larger than the number of nested loops following the construct.
7  !$omp do collapse(3)
8  do i = 1,10
9    do j = 1, 10
10      print *, "hello"
11    end do
12  end do
13  !$omp end do
14
15  do i = 1,10
16    do j = 1, 10
17      !ERROR: The value of the parameter in the COLLAPSE or ORDERED clause must not be larger than the number of nested loops following the construct.
18      !$omp do collapse(2)
19      do k = 1, 10
20        print *, "hello"
21      end do
22      !$omp end do
23    end do
24  end do
25
26  !$omp parallel do collapse(2)
27    do i = 1, 3
28      !ERROR: Loop control is not present in the DO LOOP
29      !ERROR: The associated loop of a loop-associated directive cannot be a DO without control.
30      do
31      end do
32    end do
33
34  !ERROR: At most one COLLAPSE clause can appear on the SIMD directive
35  !$omp simd collapse(2) collapse(1)
36  do i = 1, 4
37    j = j + i + 1
38  end do
39  !$omp end simd
40end program omp_doCollapse
41