117 lines · plain
1! Test lowering of derived type dummy arguments2! RUN: bbc -emit-fir %s -o - | FileCheck %s3module type_defs4 type simple_type5 integer :: i6 end type7 type with_kind(k)8 integer, kind :: k9 real(k) :: x10 end type11end module12 13! -----------------------------------------------------------------------------14! Test passing of derived type arguments that do not require a15! fir.box (runtime descriptor).16! -----------------------------------------------------------------------------17 18! Test simple type scalar with no attribute.19! CHECK-LABEL: func @_QPtest1(20! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.type<_QMtype_defsTsimple_type{i:i32}>> {fir.bindc_name = "a"}) {21subroutine test1(a)22 use type_defs23 type(simple_type) :: a24end subroutine25 26! Test simple type explicit array with no attribute.27! CHECK-LABEL: func @_QPtest2(28! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<100x!fir.type<_QMtype_defsTsimple_type{i:i32}>>> {fir.bindc_name = "a"}) {29subroutine test2(a)30 use type_defs31 type(simple_type) :: a(100)32end subroutine33 34! Test simple type scalar with TARGET attribute.35! CHECK-LABEL: func @_QPtest3(36! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.type<_QMtype_defsTsimple_type{i:i32}>> {fir.bindc_name = "a", fir.target}) {37subroutine test3(a)38 use type_defs39 type(simple_type), target :: a40end subroutine41 42! Test simple type explicit array with TARGET attribute.43! CHECK-LABEL: func @_QPtest4(44! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<100x!fir.type<_QMtype_defsTsimple_type{i:i32}>>> {fir.bindc_name = "a", fir.target}) {45subroutine test4(a)46 use type_defs47 type(simple_type), target :: a(100)48end subroutine49 50! Test kind parametrized derived type scalar with no attribute.51! CHECK-LABEL: func @_QPtest1k(52! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.type<_QMtype_defsTwith_kindK4{x:f32}>> {fir.bindc_name = "a"}) {53subroutine test1k(a)54 use type_defs55 type(with_kind(4)) :: a56end subroutine57 58! Test kind parametrized derived type explicit array with no attribute.59! CHECK-LABEL: func @_QPtest2k(60! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<100x!fir.type<_QMtype_defsTwith_kindK4{x:f32}>>> {fir.bindc_name = "a"}) {61subroutine test2k(a)62 use type_defs63 type(with_kind(4)) :: a(100)64end subroutine65 66! Test kind parametrized derived type scalar with TARGET attribute.67! CHECK-LABEL: func @_QPtest3k(68! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.type<_QMtype_defsTwith_kindK4{x:f32}>> {fir.bindc_name = "a", fir.target}) {69subroutine test3k(a)70 use type_defs71 type(with_kind(4)), target :: a72end subroutine73 74! Test kind parametrized derived type explicit array with TARGET attribute.75! CHECK-LABEL: func @_QPtest4k(76! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<100x!fir.type<_QMtype_defsTwith_kindK4{x:f32}>>> {fir.bindc_name = "a", fir.target}) {77subroutine test4k(a)78 use type_defs79 type(with_kind(4)), target :: a(100)80end subroutine81 82! -----------------------------------------------------------------------------83! Test passing of derived type arguments that require a fir.box (runtime descriptor).84! -----------------------------------------------------------------------------85 86! Test simple type assumed shape array with no attribute.87! CHECK-LABEL: func @_QPtest5(88! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<?x!fir.type<_QMtype_defsTsimple_type{i:i32}>>> {fir.bindc_name = "a"}) {89subroutine test5(a)90 use type_defs91 type(simple_type) :: a(:)92end subroutine93 94! Test simple type assumed shape array with TARGET attribute.95! CHECK-LABEL: func @_QPtest6(96! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<?x!fir.type<_QMtype_defsTsimple_type{i:i32}>>> {fir.bindc_name = "a", fir.target}) {97subroutine test6(a)98 use type_defs99 type(simple_type), target :: a(:)100end subroutine101 102! Test kind parametrized derived type assumed shape array with no attribute.103! CHECK-LABEL: func @_QPtest5k(104! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<?x!fir.type<_QMtype_defsTwith_kindK4{x:f32}>>> {fir.bindc_name = "a"}) {105subroutine test5k(a)106 use type_defs107 type(with_kind(4)) :: a(:)108end subroutine109 110! Test kind parametrized derived type assumed shape array with TARGET attribute.111! CHECK-LABEL: func @_QPtest6k(112! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<?x!fir.type<_QMtype_defsTwith_kindK4{x:f32}>>> {fir.bindc_name = "a", fir.target}) {113subroutine test6k(a)114 use type_defs115 type(with_kind(4)), target :: a(:)116end subroutine117