1 ! RUN: not %flang -fsyntax-only -fopenmp %s 2>&1 | FileCheck %s
4 ! Check invalid branches into or out of OpenMP structured blocks.
6 subroutine omp_err_end_eor(a
, b
, x
)
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
31 100 print *, "error opening"
34 200 print *, "end of file"
38 300 print *, "end of record"
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)
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
54 subroutine omp_alt_return_spec(n
, *, *)
56 if (n
.eq
. 1) return 1
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
71 !CHECK: invalid branch into an OpenMP structured block
72 !CHECK: In the enclosing PARALLEL directive branched into
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
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"
103 8 print *, "1st alternate return"
106 9 print *, "2nd alternate return"