116 lines · plain
1! RUN: not %flang -fsyntax-only -fopenmp %s 2>&1 | FileCheck %s2! OpenMP Version 4.53! Check invalid branches into or out of OpenMP structured blocks.4 5subroutine omp_err_end_eor(a, b, x)6 integer x7 8 !$omp parallel9 !CHECK: invalid branch into an OpenMP structured block10 !CHECK: In the enclosing PARALLEL directive branched into11 12 !CHECK: invalid branch leaving an OpenMP structured block13 !CHECK: Outside the enclosing PARALLEL directive14 open (10, file="myfile.dat", err=100)15 !CHECK: invalid branch leaving an OpenMP structured block16 !CHECK: Outside the enclosing PARALLEL directive17 18 !CHECK: invalid branch into an OpenMP structured block19 !CHECK: In the enclosing PARALLEL directive branched into20 21 !CHECK: invalid branch leaving an OpenMP structured block22 !CHECK: Outside the enclosing PARALLEL directive23 read (10, 20, end=200, size=x, advance='no', eor=300) a24 !$omp end parallel25 26 goto 9927 99 close (10)28 goto 4029 !$omp parallel30 100 print *, "error opening"31 !$omp end parallel32 101 return33 200 print *, "end of file"34 202 return35 36 !$omp parallel37 300 print *, "end of record"38 !$omp end parallel39 40 303 return41 20 format (1x,F5.1)42 30 format (2x,F6.2)43 !CHECK: invalid branch into an OpenMP structured block44 !CHECK: In the enclosing PARALLEL directive branched into45 40 open (11, file="myfile2.dat", err=100)46 goto 5047 !CHECK: invalid branch into an OpenMP structured block48 !CHECK: In the enclosing PARALLEL directive branched into49 50 write (11, 30, err=100) b50 close (11)51end subroutine52 53subroutine omp_alt_return_spec(n, *, *)54 if (n .eq. 0) return55 if (n .eq. 1) return 156 return 257end subroutine58 59program omp_invalid_branch60 integer :: n = 0, a = 3, b61 62 !CHECK: invalid branch into an OpenMP structured block63 !CHECK: In the enclosing PARALLEL directive branched into64 65 !CHECK: invalid branch into an OpenMP structured block66 !CHECK: In the enclosing PARALLEL directive branched into67 goto (1, 2, 3) a68 69 assign 2 to b70 !CHECK: invalid branch into an OpenMP structured block71 !CHECK: In the enclosing PARALLEL directive branched into72 goto b (1, 2)73 74 !$omp parallel75 !CHECK: invalid branch into an OpenMP structured block76 !CHECK: In the enclosing SINGLE directive branched into77 78 !CHECK: invalid branch leaving an OpenMP structured block79 !CHECK: Outside the enclosing PARALLEL directive80 3 if(n) 4, 5, 681 82 6 print *, 683 2 print *, 284 85 !$omp single86 4 print *, 487 !$omp end single88 !$omp end parallel89 90 1 print *, 191 5 print *, 592 93 !$omp parallel94 !CHECK: invalid branch into an OpenMP structured block95 !CHECK: In the enclosing SINGLE directive branched into96 97 !CHECK: invalid branch leaving an OpenMP structured block98 !CHECK: Outside the enclosing PARALLEL directive99 call omp_alt_return_spec(n, *8, *9)100 print *, "Normal Return"101 !$omp single102 8 print *, "1st alternate return"103 !$omp end single104 !$omp end parallel105 9 print *, "2nd alternate return"106 107 !CHECK: invalid branch into an OpenMP structured block108 goto 100109 !$omp scope110 100 continue111 !CHECK: invalid branch leaving an OpenMP structured block112 goto 200113 !$omp end scope114 200 continue115end program116