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

120 lines
2.5 KiB
Fortran

! Test accepted SIMPLE procedure cases.
! RUN: %flang_fc1 -fsyntax-only %s
! SIMPLE procedures satisfy PURE requirements.
module simple_satisfies_pure
implicit none
abstract interface
pure integer function pure_iface(x)
integer, intent(in) :: x
end function
end interface
contains
simple integer function simple_impl(x)
integer, intent(in) :: x
simple_impl = x
end function
pure integer function apply_requires_pure(f, x)
procedure(pure_iface) :: f
integer, intent(in) :: x
apply_requires_pure = f(x)
end function
integer function test()
test = apply_requires_pure(simple_impl, 1)
end function
end module
! Use-associated SIMPLE procedures are recognized.
module simple_use_assoc_m
contains
simple subroutine s()
end subroutine
end module
program simple_use_assoc_p
use simple_use_assoc_m
implicit none
call needs_simple(s)
contains
subroutine needs_simple(p)
abstract interface
simple subroutine simple_proc()
end subroutine
end interface
procedure(simple_proc) :: p
end subroutine
end program
! SIMPLE functions returning non-trivial CHARACTER results.
module simple_character_result
contains
simple function fixed_len_character() result(res)
character(len=5) :: res
res = "hello"
end function
simple function dependent_len_character(x) result(res)
character(*), intent(in) :: x
character(len=len(x)) :: res
res = x
end function
subroutine test()
character(len=3) :: a
character(len=7) :: b
a = dependent_len_character("abc")
b = dependent_len_character("testing")
end subroutine
end module
! SIMPLE and PURE may both appear in either order.
module simple_pure_order
contains
simple pure subroutine simple_pure_sub()
end subroutine
pure simple subroutine pure_simple_sub()
end subroutine
subroutine test()
call simple_pure_sub()
call pure_simple_sub()
end subroutine
end module
! SIMPLE separate module function is accepted.
module m_smf
interface
simple module function f(x) result(res)
integer, intent(in) :: x
integer :: res
end function
end interface
end module
submodule(m_smf) sm_smf
contains
module procedure f
res = x
end procedure
end submodule
! MODULE SIMPLE function prefix order is accepted.
module m_msf
interface
module simple function g(x) result(res)
integer, intent(in) :: x
integer :: res
end function
end interface
end module
submodule(m_msf) sm_msf
contains
module procedure g
res = x
end procedure
end submodule