Files
clang-p2996/flang/test/Semantics/omp-loop-association.f90
Tim Keith 99aa87a5b5 [flang][NFC] Simplify semantics test scripts
There were several different ways of handling the option to f18 to
find predefined modules:
- test_errors.sh was created by cmake substituting
  FLANG_INTRINSIC_MODULES_DIR into test_errors.sh.in
- some tests used the flang script which has the option built it
- some tests used %f18_with_includes which was replaced by the path
  to f18 plus the -I option
- some included -I../../include/flang in their run command

To make this more consistent, change %f18 to include the
-intrinsic-module-directory option and use it everywhere, including
to replace %flang and %f18_with_includes. This requires changing all
of the invocations of the test scripts to put %f18 at the end so that
it can expand to more than one argument.

This eliminates the need to generate test_errors.sh which means we
don't need flang/test/Semantics/CMakeLists.txt or the %B substitution.
That makes the test_errors.sh command like the others, replacing
%B/test/Semantics/test_errors.sh with %S/test_errors.sh.

Also remove the OPTIONS: functionality as custom options can be included
in the RUN: command. And remove -I/../../include/flang as that is now
always included.

Differential Revision: https://reviews.llvm.org/D79634
2020-05-11 11:49:25 -07:00

127 lines
2.9 KiB
Fortran

! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
! Check the association between OpenMPLoopConstruct and DoConstruct
integer :: b = 128
integer :: c = 32
integer, parameter :: num = 16
N = 1024
! Different DO loops
!$omp parallel
!$omp do
do 10 i=1, N
a = 3.14
10 print *, a
!$omp end parallel
!$omp parallel do
DO CONCURRENT (i = 1:N)
a = 3.14
END DO
!$omp parallel do simd
outer: DO WHILE (c > 1)
inner: do while (b > 100)
a = 3.14
b = b - 1
enddo inner
c = c - 1
END DO outer
c = 16
!ERROR: DO loop after the PARALLEL DO directive must have loop control
!$omp parallel do
do
a = 3.14
c = c - 1
if (c < 1) exit
enddo
! Loop association check
! If an end do directive follows a do-construct in which several DO
! statements share a DO termination statement, then a do directive
! can only be specified for the outermost of these DO statements.
do 100 i=1, N
!$omp do
do 100 j=1, N
a = 3.14
100 continue
!ERROR: The ENDDO directive must follow the DO loop associated with the loop construct
!$omp enddo
!$omp parallel do copyin(a)
do i = 1, N
!$omp parallel do
do j = 1, i
enddo
!$omp end parallel do
a = 3.
enddo
!$omp end parallel do
!$omp parallel do
do i = 1, N
enddo
!$omp end parallel do
!ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct
!$omp end parallel do
!$omp parallel
a = 3.0
!$omp do simd
do i = 1, N
enddo
!$omp end do simd
!$omp parallel do copyin(a)
do i = 1, N
enddo
!$omp end parallel
a = 0.0
!ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct
!$omp end parallel do
!$omp parallel do private(c)
do i = 1, N
do j = 1, N
!ERROR: A DO loop must follow the PARALLEL DO directive
!$omp parallel do shared(b)
a = 3.14
enddo
!ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct
!$omp end parallel do
enddo
a = 1.414
!ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct
!$omp end parallel do
do i = 1, N
!$omp parallel do
do j = 2*i*N, (2*i+1)*N
a = 3.14
enddo
enddo
!ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct
!$omp end parallel do
!ERROR: A DO loop must follow the PARALLEL DO directive
!$omp parallel do private(c)
5 FORMAT (1PE12.4, I10)
do i=1, N
a = 3.14
enddo
!ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct
!$omp end parallel do
!$omp parallel do simd
do i = 1, N
a = 3.14
enddo
!$omp end parallel do simd
!ERROR: The END PARALLEL DO SIMD directive must follow the DO loop associated with the loop construct
!$omp end parallel do simd
end