1 ! Test lowering of derived type dummy arguments
2 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
13 ! -----------------------------------------------------------------------------
14 ! Test passing of derived type arguments that do not require a
15 ! fir.box (runtime descriptor).
16 ! -----------------------------------------------------------------------------
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"}) {
23 type(simple_type
) :: a
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"}) {
31 type(simple_type
) :: a(100)
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}) {
39 type(simple_type
), target
:: a
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}) {
47 type(simple_type
), target
:: a(100)
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"}) {
55 type(with_kind(4)) :: a
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"}) {
63 type(with_kind(4)) :: a(100)
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}) {
71 type(with_kind(4)), target
:: a
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}) {
79 type(with_kind(4)), target
:: a(100)
82 ! -----------------------------------------------------------------------------
83 ! Test passing of derived type arguments that require a fir.box (runtime descriptor).
84 ! -----------------------------------------------------------------------------
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"}) {
91 type(simple_type
) :: a(:)
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}) {
99 type(simple_type
), target
:: a(:)
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"}) {
107 type(with_kind(4)) :: a(:)
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}) {
115 type(with_kind(4)), target
:: a(:)