xref: /llvm-project/flang/test/Semantics/OpenMP/simd01.f90 (revision 87452bcb806c9a45b09dab7c2e6594a7ebb085a2)
1! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2! OpenMP Version 5.0
3! 2.9.3.1 simd Construct
4!   - A program that branches into or out of a simd region is non-conforming.
5!   - The associated loops must be structured blocks
6
7program omp_simd
8   integer i, j
9
10   !$omp simd
11   do i = 1, 10
12      do j = 1, 10
13         print *, "omp simd"
14         !ERROR: invalid branch leaving an OpenMP structured block
15         goto 10
16      end do
17      if (i .EQ. 5) THEN
18         call function1()
19      else if (i .EQ. 7) THEN
20         open (10, file="random-file-name.txt", err=20)
2120       print *, "Error message doesn't branch out of the loop's structured block"
22      else
23         !ERROR: invalid branch leaving an OpenMP structured block
24         open (10, file="random-file-name.txt", err=10)
25      end if
26   end do
27   !$omp end simd
2810 stop
29
30end program omp_simd
31
32subroutine function1()
33   integer i, option
34   option = 1
35   !$omp simd
36   do i = 1, 10
37      print *, "CORRECT SIMD LOOP"
38   end do
39   !$omp end simd
40end subroutine function1
41