[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / OpenMP / omp-invalid-branch.f90
blobed9e4d268f65a8c49f426723dae6914a7960e4fc
1 ! RUN: not %flang -fsyntax-only -fopenmp %s 2>&1 | FileCheck %s
2 ! REQUIRES: shell
3 ! OpenMP Version 4.5
4 ! Check invalid branches into or out of OpenMP structured blocks.
6 subroutine omp_err_end_eor(a, b, x)
7 integer x
9 !$omp parallel
10 !CHECK: invalid branch into an OpenMP structured block
11 !CHECK: In the enclosing PARALLEL directive branched into
13 !CHECK: invalid branch leaving an OpenMP structured block
14 !CHECK: Outside the enclosing PARALLEL directive
15 open (10, file="myfile.dat", err=100)
16 !CHECK: invalid branch leaving an OpenMP structured block
17 !CHECK: Outside the enclosing PARALLEL directive
19 !CHECK: invalid branch into an OpenMP structured block
20 !CHECK: In the enclosing PARALLEL directive branched into
22 !CHECK: invalid branch leaving an OpenMP structured block
23 !CHECK: Outside the enclosing PARALLEL directive
24 read (10, 20, end=200, size=x, advance='no', eor=300) a
25 !$omp end parallel
27 goto 99
28 99 close (10)
29 goto 40
30 !$omp parallel
31 100 print *, "error opening"
32 !$omp end parallel
33 101 return
34 200 print *, "end of file"
35 202 return
37 !$omp parallel
38 300 print *, "end of record"
39 !$omp end parallel
41 303 return
42 20 format (1x,F5.1)
43 30 format (2x,F6.2)
44 !CHECK: invalid branch into an OpenMP structured block
45 !CHECK: In the enclosing PARALLEL directive branched into
46 40 open (11, file="myfile2.dat", err=100)
47 goto 50
48 !CHECK: invalid branch into an OpenMP structured block
49 !CHECK: In the enclosing PARALLEL directive branched into
50 50 write (11, 30, err=100) b
51 close (11)
52 end subroutine
54 subroutine omp_alt_return_spec(n, *, *)
55 if (n .eq. 0) return
56 if (n .eq. 1) return 1
57 return 2
58 end subroutine
60 program omp_invalid_branch
61 integer :: n = 0, a = 3, b
63 !CHECK: invalid branch into an OpenMP structured block
64 !CHECK: In the enclosing PARALLEL directive branched into
66 !CHECK: invalid branch into an OpenMP structured block
67 !CHECK: In the enclosing PARALLEL directive branched into
68 goto (1, 2, 3) a
70 assign 2 to b
71 !CHECK: invalid branch into an OpenMP structured block
72 !CHECK: In the enclosing PARALLEL directive branched into
73 goto b (1, 2)
75 !$omp parallel
76 !CHECK: invalid branch into an OpenMP structured block
77 !CHECK: In the enclosing SINGLE directive branched into
79 !CHECK: invalid branch leaving an OpenMP structured block
80 !CHECK: Outside the enclosing PARALLEL directive
81 3 if(n) 4, 5, 6
83 6 print *, 6
84 2 print *, 2
86 !$omp single
87 4 print *, 4
88 !$omp end single
89 !$omp end parallel
91 1 print *, 1
92 5 print *, 5
94 !$omp parallel
95 !CHECK: invalid branch into an OpenMP structured block
96 !CHECK: In the enclosing SINGLE directive branched into
98 !CHECK: invalid branch leaving an OpenMP structured block
99 !CHECK: Outside the enclosing PARALLEL directive
100 call omp_alt_return_spec(n, *8, *9)
101 print *, "Normal Return"
102 !$omp single
103 8 print *, "1st alternate return"
104 !$omp end single
105 !$omp end parallel
106 9 print *, "2nd alternate return"
108 end program