Files
TheRock/compiler/amd-llvm/flang/test/Semantics/rank-clause01.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

71 lines
1.6 KiB
Fortran

! Test the new RANK clause. This uses the examples from the F2023 Standard and
! related explanation documents.
!
! RUN: %python %S/test_errors.py %s %flang_fc1
program rank_clause01
implicit none
logical :: X0(10,10,10)
integer :: array1(10,10)
interface
subroutine sub02(arg1)
integer, rank(2) :: arg1
end subroutine
end interface
call sub01(X0)
call sub02(array1)
call sub_errors()
contains
subroutine sub01(X3)
integer :: X0(10,10,10)
logical, rank(rank(X0)), allocatable :: X1 ! Rank 3, deferred shape
complex, rank(2), pointer :: X2 ! Rank 2, deferred-shape
logical, rank(rank(X0)) :: X3 ! Rank 3, assumed-shape
real, rank(0) :: X4 ! Scalar
allocatable :: X4
if (rank(X1) == 3 .and. rank(X2) == 2 .and. rank(X3) == 3 .and. &
rank(X4) == 0) then
print *, "PASS"
else
print *, "FAIL"
endif
end subroutine
subroutine sub_errors()
integer :: not_constant
! Rank below range
!ERROR: RANK value (-1) must be between 0 and 15
integer, rank(-1) :: err_rank01
! Rank above range
!ERROR: RANK value (16) must be between 0 and 15
integer, rank(16) :: err_rank02
! Non-Constant
!ERROR: RANK value must be a constant expression
!ERROR: Must be a constant value
integer, rank(not_constant) :: err_rank03
end subroutine
end program
subroutine sub02(A)
integer, rank(2) :: A
integer, allocatable, rank(2) :: B
if (rank(A) == rank(B)) then
print *, "PASS"
else
print *, "FAIL"
endif
end subroutine