Files
TheRock/compiler/amd-llvm/flang/test/Semantics/OpenMP/invalid-branch.f90
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

116 lines
3.1 KiB
Fortran

! RUN: not %flang -fsyntax-only -fopenmp %s 2>&1 | FileCheck %s
! OpenMP Version 4.5
! Check invalid branches into or out of OpenMP structured blocks.
subroutine omp_err_end_eor(a, b, x)
integer x
!$omp parallel
!CHECK: invalid branch into an OpenMP structured block
!CHECK: In the enclosing PARALLEL directive branched into
!CHECK: invalid branch leaving an OpenMP structured block
!CHECK: Outside the enclosing PARALLEL directive
open (10, file="myfile.dat", err=100)
!CHECK: invalid branch leaving an OpenMP structured block
!CHECK: Outside the enclosing PARALLEL directive
!CHECK: invalid branch into an OpenMP structured block
!CHECK: In the enclosing PARALLEL directive branched into
!CHECK: invalid branch leaving an OpenMP structured block
!CHECK: Outside the enclosing PARALLEL directive
read (10, 20, end=200, size=x, advance='no', eor=300) a
!$omp end parallel
goto 99
99 close (10)
goto 40
!$omp parallel
100 print *, "error opening"
!$omp end parallel
101 return
200 print *, "end of file"
202 return
!$omp parallel
300 print *, "end of record"
!$omp end parallel
303 return
20 format (1x,F5.1)
30 format (2x,F6.2)
!CHECK: invalid branch into an OpenMP structured block
!CHECK: In the enclosing PARALLEL directive branched into
40 open (11, file="myfile2.dat", err=100)
goto 50
!CHECK: invalid branch into an OpenMP structured block
!CHECK: In the enclosing PARALLEL directive branched into
50 write (11, 30, err=100) b
close (11)
end subroutine
subroutine omp_alt_return_spec(n, *, *)
if (n .eq. 0) return
if (n .eq. 1) return 1
return 2
end subroutine
program omp_invalid_branch
integer :: n = 0, a = 3, b
!CHECK: invalid branch into an OpenMP structured block
!CHECK: In the enclosing PARALLEL directive branched into
!CHECK: invalid branch into an OpenMP structured block
!CHECK: In the enclosing PARALLEL directive branched into
goto (1, 2, 3) a
assign 2 to b
!CHECK: invalid branch into an OpenMP structured block
!CHECK: In the enclosing PARALLEL directive branched into
goto b (1, 2)
!$omp parallel
!CHECK: invalid branch into an OpenMP structured block
!CHECK: In the enclosing SINGLE directive branched into
!CHECK: invalid branch leaving an OpenMP structured block
!CHECK: Outside the enclosing PARALLEL directive
3 if(n) 4, 5, 6
6 print *, 6
2 print *, 2
!$omp single
4 print *, 4
!$omp end single
!$omp end parallel
1 print *, 1
5 print *, 5
!$omp parallel
!CHECK: invalid branch into an OpenMP structured block
!CHECK: In the enclosing SINGLE directive branched into
!CHECK: invalid branch leaving an OpenMP structured block
!CHECK: Outside the enclosing PARALLEL directive
call omp_alt_return_spec(n, *8, *9)
print *, "Normal Return"
!$omp single
8 print *, "1st alternate return"
!$omp end single
!$omp end parallel
9 print *, "2nd alternate return"
!CHECK: invalid branch into an OpenMP structured block
goto 100
!$omp scope
100 continue
!CHECK: invalid branch leaving an OpenMP structured block
goto 200
!$omp end scope
200 continue
end program