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
102 lines
5.2 KiB
Fortran
102 lines
5.2 KiB
Fortran
! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
|
|
|
|
! Test passing allocatables on caller side
|
|
|
|
! CHECK-LABEL: func @_QPtest_scalar_call(
|
|
subroutine test_scalar_call()
|
|
interface
|
|
subroutine test_scalar(x)
|
|
real, allocatable :: x
|
|
end subroutine
|
|
end interface
|
|
real, allocatable :: x
|
|
! CHECK: %[[alloca:.*]] = fir.alloca !fir.box<!fir.heap<f32>> {{{.*}}uniq_name = "_QFtest_scalar_callEx"}
|
|
! CHECK: %[[box:.*]]:2 = hlfir.declare %[[alloca]]{{.*}}allocatable
|
|
call test_scalar(x)
|
|
! CHECK: fir.call @_QPtest_scalar(%[[box]]#0) {{.*}}: (!fir.ref<!fir.box<!fir.heap<f32>>>) -> ()
|
|
end subroutine
|
|
|
|
! CHECK-LABEL: func @_QPtest_array_call(
|
|
subroutine test_array_call()
|
|
interface
|
|
subroutine test_array(x)
|
|
integer, allocatable :: x(:)
|
|
end subroutine
|
|
end interface
|
|
integer, allocatable :: x(:)
|
|
! CHECK: %[[alloca:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?xi32>>> {{{.*}}uniq_name = "_QFtest_array_callEx"}
|
|
! CHECK: %[[box:.*]]:2 = hlfir.declare %[[alloca]]{{.*}}allocatable
|
|
call test_array(x)
|
|
! CHECK: fir.call @_QPtest_array(%[[box]]#0) {{.*}}: (!fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>) -> ()
|
|
end subroutine
|
|
|
|
! CHECK-LABEL: func @_QPtest_char_scalar_deferred_call(
|
|
subroutine test_char_scalar_deferred_call()
|
|
interface
|
|
subroutine test_char_scalar_deferred(x)
|
|
character(:), allocatable :: x
|
|
end subroutine
|
|
end interface
|
|
character(:), allocatable :: x
|
|
! CHECK: %[[alloca:.*]] = fir.alloca !fir.box<!fir.heap<!fir.char<1,?>>> {{{.*}}uniq_name = "_QFtest_char_scalar_deferred_callEx"}
|
|
! CHECK: %[[box:.*]]:2 = hlfir.declare %[[alloca]]{{.*}}allocatable
|
|
call test_char_scalar_deferred(x)
|
|
! CHECK: fir.call @_QPtest_char_scalar_deferred(%[[box]]#0) {{.*}}: (!fir.ref<!fir.box<!fir.heap<!fir.char<1,?>>>>) -> ()
|
|
end subroutine
|
|
|
|
! CHECK-LABEL: func @_QPtest_char_scalar_explicit_call(
|
|
subroutine test_char_scalar_explicit_call(n)
|
|
integer :: n
|
|
interface
|
|
subroutine test_char_scalar_explicit(x)
|
|
character(10), allocatable :: x
|
|
end subroutine
|
|
end interface
|
|
character(10), allocatable :: x
|
|
character(n), allocatable :: x2
|
|
! CHECK: %[[alloca:.*]] = fir.alloca !fir.box<!fir.heap<!fir.char<1,10>>> {{{.*}}uniq_name = "_QFtest_char_scalar_explicit_callEx"}
|
|
! CHECK: %[[box:.*]]:2 = hlfir.declare %[[alloca]] typeparams %{{.*}} {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFtest_char_scalar_explicit_callEx"}
|
|
! CHECK: %[[alloca2:.*]] = fir.alloca !fir.box<!fir.heap<!fir.char<1,?>>> {{{.*}}uniq_name = "_QFtest_char_scalar_explicit_callEx2"}
|
|
! CHECK: %[[box2:.*]]:2 = hlfir.declare %[[alloca2]] typeparams %{{.*}} {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFtest_char_scalar_explicit_callEx2"}
|
|
call test_char_scalar_explicit(x)
|
|
! CHECK: fir.call @_QPtest_char_scalar_explicit(%[[box]]#0) {{.*}}: (!fir.ref<!fir.box<!fir.heap<!fir.char<1,10>>>>) -> ()
|
|
call test_char_scalar_explicit(x2)
|
|
! CHECK: %[[box2cast:.*]] = fir.convert %[[box2]]#0 : (!fir.ref<!fir.box<!fir.heap<!fir.char<1,?>>>>) -> !fir.ref<!fir.box<!fir.heap<!fir.char<1,10>>>>
|
|
! CHECK: fir.call @_QPtest_char_scalar_explicit(%[[box2cast]]) {{.*}}: (!fir.ref<!fir.box<!fir.heap<!fir.char<1,10>>>>) -> ()
|
|
end subroutine
|
|
|
|
! CHECK-LABEL: func @_QPtest_char_array_deferred_call(
|
|
subroutine test_char_array_deferred_call()
|
|
interface
|
|
subroutine test_char_array_deferred(x)
|
|
character(:), allocatable :: x(:)
|
|
end subroutine
|
|
end interface
|
|
character(:), allocatable :: x(:)
|
|
! CHECK: %[[alloca:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>> {{{.*}}uniq_name = "_QFtest_char_array_deferred_callEx"}
|
|
! CHECK: %[[box:.*]]:2 = hlfir.declare %[[alloca]]{{.*}}allocatable
|
|
call test_char_array_deferred(x)
|
|
! CHECK: fir.call @_QPtest_char_array_deferred(%[[box]]#0) {{.*}}: (!fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>>) -> ()
|
|
end subroutine
|
|
|
|
! CHECK-LABEL: func @_QPtest_char_array_explicit_call(
|
|
subroutine test_char_array_explicit_call(n)
|
|
integer :: n
|
|
interface
|
|
subroutine test_char_array_explicit(x)
|
|
character(10), allocatable :: x(:)
|
|
end subroutine
|
|
end interface
|
|
character(10), allocatable :: x(:)
|
|
character(n), allocatable :: x2(:)
|
|
! CHECK: %[[alloca:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x!fir.char<1,10>>>> {{{.*}}uniq_name = "_QFtest_char_array_explicit_callEx"}
|
|
! CHECK: %[[box:.*]]:2 = hlfir.declare %[[alloca]] typeparams %{{.*}} {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFtest_char_array_explicit_callEx"}
|
|
! CHECK: %[[alloca2:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>> {{{.*}}uniq_name = "_QFtest_char_array_explicit_callEx2"}
|
|
! CHECK: %[[box2:.*]]:2 = hlfir.declare %[[alloca2]] typeparams %{{.*}} {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFtest_char_array_explicit_callEx2"}
|
|
call test_char_array_explicit(x)
|
|
! CHECK: fir.call @_QPtest_char_array_explicit(%[[box]]#0) {{.*}}: (!fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,10>>>>>) -> ()
|
|
call test_char_array_explicit(x2)
|
|
! CHECK: %[[box2cast:.*]] = fir.convert %[[box2]]#0 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>>) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,10>>>>>
|
|
! CHECK: fir.call @_QPtest_char_array_explicit(%[[box2cast]]) {{.*}}: (!fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,10>>>>>) -> ()
|
|
end subroutine
|