| 1 |
! Test actual TARGET argument association to dummy POINTER: |
| 2 |
! RUN: bbc -emit-hlfir -o - -I nowhere %s 2>&1 | FileCheck %s |
| 3 |
|
| 4 |
module target_to_pointer_types |
| 5 |
type t1 |
| 6 |
end type t1 |
| 7 |
end module target_to_pointer_types |
| 8 |
|
| 9 |
subroutine integer_scalar() |
| 10 |
interface |
| 11 |
subroutine integer_scalar_callee(p) |
| 12 |
integer, pointer, intent(in) :: p |
| 13 |
end subroutine integer_scalar_callee |
| 14 |
subroutine integer_scalar_uclass_callee(p) |
| 15 |
class(*), pointer, intent(in) :: p |
| 16 |
end subroutine integer_scalar_uclass_callee |
| 17 |
end interface |
| 18 |
integer, target :: i |
| 19 |
call integer_scalar_callee(i) |
| 20 |
call integer_scalar_uclass_callee(i) |
| 21 |
end subroutine integer_scalar |
| 22 |
! CHECK-LABEL: func.func @_QPinteger_scalar() { |
| 23 |
! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.class<!fir.ptr<none>> |
| 24 |
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.box<!fir.ptr<i32>> |
| 25 |
! CHECK: %[[VAL_2:.*]] = fir.alloca i32 {bindc_name = "i", fir.target, uniq_name = "_QFinteger_scalarEi"} |
| 26 |
! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_2]] {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFinteger_scalarEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) |
| 27 |
! CHECK: %[[VAL_4:.*]] = fir.embox %[[VAL_3]]#1 : (!fir.ref<i32>) -> !fir.box<!fir.ptr<i32>> |
| 28 |
! CHECK: fir.store %[[VAL_4]] to %[[VAL_1]] : !fir.ref<!fir.box<!fir.ptr<i32>>> |
| 29 |
! CHECK: fir.call @_QPinteger_scalar_callee(%[[VAL_1]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<i32>>>) -> () |
| 30 |
! CHECK: %[[VAL_5:.*]] = fir.embox %[[VAL_3]]#1 : (!fir.ref<i32>) -> !fir.class<!fir.ptr<none>> |
| 31 |
! CHECK: fir.store %[[VAL_5]] to %[[VAL_0]] : !fir.ref<!fir.class<!fir.ptr<none>>> |
| 32 |
! CHECK: fir.call @_QPinteger_scalar_uclass_callee(%[[VAL_0]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<none>>>) -> () |
| 33 |
! CHECK: return |
| 34 |
! CHECK: } |
| 35 |
|
| 36 |
subroutine integer_assumed_shape_array(i) |
| 37 |
interface |
| 38 |
subroutine integer_assumed_shape_array_callee(p) |
| 39 |
integer, pointer, intent(in) :: p(:) |
| 40 |
end subroutine integer_assumed_shape_array_callee |
| 41 |
subroutine integer_assumed_shape_array_uclass_callee(p) |
| 42 |
class(*), pointer, intent(in) :: p(:) |
| 43 |
end subroutine integer_assumed_shape_array_uclass_callee |
| 44 |
end interface |
| 45 |
integer, target :: i(:) |
| 46 |
call integer_assumed_shape_array_callee(i) |
| 47 |
call integer_assumed_shape_array_uclass_callee(i) |
| 48 |
end subroutine integer_assumed_shape_array |
| 49 |
! CHECK-LABEL: func.func @_QPinteger_assumed_shape_array( |
| 50 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<?xi32>> {fir.bindc_name = "i", fir.target}) { |
| 51 |
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 52 |
! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?xi32>>> |
| 53 |
! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFinteger_assumed_shape_arrayEi"} : (!fir.box<!fir.array<?xi32>>, !fir.dscope) -> (!fir.box<!fir.array<?xi32>>, !fir.box<!fir.array<?xi32>>) |
| 54 |
! CHECK: %[[VAL_4:.*]] = fir.rebox %[[VAL_3]]#1 : (!fir.box<!fir.array<?xi32>>) -> !fir.box<!fir.ptr<!fir.array<?xi32>>> |
| 55 |
! CHECK: fir.store %[[VAL_4]] to %[[VAL_2]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>> |
| 56 |
! CHECK: fir.call @_QPinteger_assumed_shape_array_callee(%[[VAL_2]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>) -> () |
| 57 |
! CHECK: %[[VAL_5:.*]] = fir.rebox %[[VAL_3]]#1 : (!fir.box<!fir.array<?xi32>>) -> !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 58 |
! CHECK: fir.store %[[VAL_5]] to %[[VAL_1]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>> |
| 59 |
! CHECK: fir.call @_QPinteger_assumed_shape_array_uclass_callee(%[[VAL_1]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>>) -> () |
| 60 |
! CHECK: return |
| 61 |
! CHECK: } |
| 62 |
|
| 63 |
subroutine integer_explicit_shape_array() |
| 64 |
interface |
| 65 |
subroutine integer_explicit_shape_array_callee(p) |
| 66 |
integer, pointer, intent(in) :: p(:) |
| 67 |
end subroutine integer_explicit_shape_array_callee |
| 68 |
subroutine integer_explicit_shape_array_uclass_callee(p) |
| 69 |
class(*), pointer, intent(in) :: p(:) |
| 70 |
end subroutine integer_explicit_shape_array_uclass_callee |
| 71 |
end interface |
| 72 |
integer, target :: i(100) |
| 73 |
call integer_explicit_shape_array_callee(i) |
| 74 |
call integer_explicit_shape_array_uclass_callee(i) |
| 75 |
end subroutine integer_explicit_shape_array |
| 76 |
! CHECK-LABEL: func.func @_QPinteger_explicit_shape_array() { |
| 77 |
! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 78 |
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?xi32>>> |
| 79 |
! CHECK: %[[VAL_2:.*]] = arith.constant 100 : index |
| 80 |
! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.array<100xi32> {bindc_name = "i", fir.target, uniq_name = "_QFinteger_explicit_shape_arrayEi"} |
| 81 |
! CHECK: %[[VAL_4:.*]] = fir.shape %[[VAL_2]] : (index) -> !fir.shape<1> |
| 82 |
! CHECK: %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_3]](%[[VAL_4]]) {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFinteger_explicit_shape_arrayEi"} : (!fir.ref<!fir.array<100xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<100xi32>>, !fir.ref<!fir.array<100xi32>>) |
| 83 |
! CHECK: %[[VAL_6:.*]] = fir.shape %[[VAL_2]] : (index) -> !fir.shape<1> |
| 84 |
! CHECK: %[[VAL_7:.*]] = fir.embox %[[VAL_5]]#1(%[[VAL_6]]) : (!fir.ref<!fir.array<100xi32>>, !fir.shape<1>) -> !fir.box<!fir.ptr<!fir.array<?xi32>>> |
| 85 |
! CHECK: fir.store %[[VAL_7]] to %[[VAL_1]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>> |
| 86 |
! CHECK: fir.call @_QPinteger_explicit_shape_array_callee(%[[VAL_1]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>) -> () |
| 87 |
! CHECK: %[[VAL_8:.*]] = fir.shape %[[VAL_2]] : (index) -> !fir.shape<1> |
| 88 |
! CHECK: %[[VAL_9:.*]] = fir.embox %[[VAL_5]]#1(%[[VAL_8]]) : (!fir.ref<!fir.array<100xi32>>, !fir.shape<1>) -> !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 89 |
! CHECK: fir.store %[[VAL_9]] to %[[VAL_0]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>> |
| 90 |
! CHECK: fir.call @_QPinteger_explicit_shape_array_uclass_callee(%[[VAL_0]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>>) -> () |
| 91 |
! CHECK: return |
| 92 |
! CHECK: } |
| 93 |
|
| 94 |
subroutine char_scalar() |
| 95 |
interface |
| 96 |
subroutine char_scalar_explicit_len_callee(p) |
| 97 |
character(2), pointer, intent(in) :: p |
| 98 |
end subroutine char_scalar_explicit_len_callee |
| 99 |
subroutine char_scalar_assumed_len_callee(p) |
| 100 |
character(*), pointer, intent(in) :: p |
| 101 |
end subroutine char_scalar_assumed_len_callee |
| 102 |
subroutine char_scalar_uclass_callee(p) |
| 103 |
class(*), pointer, intent(in) :: p |
| 104 |
end subroutine char_scalar_uclass_callee |
| 105 |
end interface |
| 106 |
character(2), target :: a |
| 107 |
call char_scalar_explicit_len_callee(a) |
| 108 |
call char_scalar_assumed_len_callee(a) |
| 109 |
call char_scalar_uclass_callee(a) |
| 110 |
end subroutine char_scalar |
| 111 |
! CHECK-LABEL: func.func @_QPchar_scalar() { |
| 112 |
! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.class<!fir.ptr<none>> |
| 113 |
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.char<1,?>>> |
| 114 |
! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.char<1,2>>> |
| 115 |
! CHECK: %[[VAL_3:.*]] = arith.constant 2 : index |
| 116 |
! CHECK: %[[VAL_4:.*]] = fir.alloca !fir.char<1,2> {bindc_name = "a", fir.target, uniq_name = "_QFchar_scalarEa"} |
| 117 |
! CHECK: %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_4]] typeparams %[[VAL_3]] {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFchar_scalarEa"} : (!fir.ref<!fir.char<1,2>>, index) -> (!fir.ref<!fir.char<1,2>>, !fir.ref<!fir.char<1,2>>) |
| 118 |
! CHECK: %[[VAL_6:.*]] = fir.embox %[[VAL_5]]#1 : (!fir.ref<!fir.char<1,2>>) -> !fir.box<!fir.ptr<!fir.char<1,2>>> |
| 119 |
! CHECK: fir.store %[[VAL_6]] to %[[VAL_2]] : !fir.ref<!fir.box<!fir.ptr<!fir.char<1,2>>>> |
| 120 |
! CHECK: fir.call @_QPchar_scalar_explicit_len_callee(%[[VAL_2]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.char<1,2>>>>) -> () |
| 121 |
! CHECK: %[[VAL_7:.*]] = fir.convert %[[VAL_5]]#1 : (!fir.ref<!fir.char<1,2>>) -> !fir.ref<!fir.char<1,?>> |
| 122 |
! CHECK: %[[VAL_8:.*]] = fir.embox %[[VAL_7]] typeparams %[[VAL_3]] : (!fir.ref<!fir.char<1,?>>, index) -> !fir.box<!fir.ptr<!fir.char<1,?>>> |
| 123 |
! CHECK: fir.store %[[VAL_8]] to %[[VAL_1]] : !fir.ref<!fir.box<!fir.ptr<!fir.char<1,?>>>> |
| 124 |
! CHECK: fir.call @_QPchar_scalar_assumed_len_callee(%[[VAL_1]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.char<1,?>>>>) -> () |
| 125 |
! CHECK: %[[VAL_9:.*]] = fir.embox %[[VAL_5]]#1 : (!fir.ref<!fir.char<1,2>>) -> !fir.class<!fir.ptr<none>> |
| 126 |
! CHECK: fir.store %[[VAL_9]] to %[[VAL_0]] : !fir.ref<!fir.class<!fir.ptr<none>>> |
| 127 |
! CHECK: fir.call @_QPchar_scalar_uclass_callee(%[[VAL_0]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<none>>>) -> () |
| 128 |
! CHECK: return |
| 129 |
! CHECK: } |
| 130 |
|
| 131 |
subroutine char_assumed_shape_array(a1, a2) |
| 132 |
interface |
| 133 |
subroutine char_assumed_shape_array_explicit_len_callee(p) |
| 134 |
character(2), pointer, intent(in) :: p(:) |
| 135 |
end subroutine char_assumed_shape_array_explicit_len_callee |
| 136 |
subroutine char_assumed_shape_array_assumed_len_callee(p) |
| 137 |
character(*), pointer, intent(in) :: p(:) |
| 138 |
end subroutine char_assumed_shape_array_assumed_len_callee |
| 139 |
subroutine char_assumed_shape_array_uclass_callee(p) |
| 140 |
class(*), pointer, intent(in) :: p(:) |
| 141 |
end subroutine char_assumed_shape_array_uclass_callee |
| 142 |
end interface |
| 143 |
character(2), target :: a1(:) |
| 144 |
character(*), target :: a2(:) |
| 145 |
call char_assumed_shape_array_explicit_len_callee(a1) |
| 146 |
call char_assumed_shape_array_assumed_len_callee(a1) |
| 147 |
call char_assumed_shape_array_uclass_callee(a1) |
| 148 |
call char_assumed_shape_array_explicit_len_callee(a2) |
| 149 |
call char_assumed_shape_array_assumed_len_callee(a2) |
| 150 |
call char_assumed_shape_array_uclass_callee(a2) |
| 151 |
end subroutine char_assumed_shape_array |
| 152 |
! CHECK-LABEL: func.func @_QPchar_assumed_shape_array( |
| 153 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<?x!fir.char<1,2>>> {fir.bindc_name = "a1", fir.target}, |
| 154 |
! CHECK-SAME: %[[VAL_1:.*]]: !fir.box<!fir.array<?x!fir.char<1,?>>> {fir.bindc_name = "a2", fir.target}) { |
| 155 |
! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 156 |
! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>> |
| 157 |
! CHECK: %[[VAL_4:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>> |
| 158 |
! CHECK: %[[VAL_5:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 159 |
! CHECK: %[[VAL_6:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>> |
| 160 |
! CHECK: %[[VAL_7:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>> |
| 161 |
! CHECK: %[[VAL_8:.*]] = arith.constant 2 : index |
| 162 |
! CHECK: %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_0]] typeparams %[[VAL_8]] dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFchar_assumed_shape_arrayEa1"} : (!fir.box<!fir.array<?x!fir.char<1,2>>>, index, !fir.dscope) -> (!fir.box<!fir.array<?x!fir.char<1,2>>>, !fir.box<!fir.array<?x!fir.char<1,2>>>) |
| 163 |
! CHECK: %[[VAL_10:.*]]:2 = hlfir.declare %[[VAL_1]] dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFchar_assumed_shape_arrayEa2"} : (!fir.box<!fir.array<?x!fir.char<1,?>>>, !fir.dscope) -> (!fir.box<!fir.array<?x!fir.char<1,?>>>, !fir.box<!fir.array<?x!fir.char<1,?>>>) |
| 164 |
! CHECK: %[[VAL_11:.*]] = fir.rebox %[[VAL_9]]#1 : (!fir.box<!fir.array<?x!fir.char<1,2>>>) -> !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>> |
| 165 |
! CHECK: fir.store %[[VAL_11]] to %[[VAL_7]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>>> |
| 166 |
! CHECK: fir.call @_QPchar_assumed_shape_array_explicit_len_callee(%[[VAL_7]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>>>) -> () |
| 167 |
! CHECK: %[[VAL_12:.*]] = fir.rebox %[[VAL_9]]#1 : (!fir.box<!fir.array<?x!fir.char<1,2>>>) -> !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>> |
| 168 |
! CHECK: fir.store %[[VAL_12]] to %[[VAL_6]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>> |
| 169 |
! CHECK: fir.call @_QPchar_assumed_shape_array_assumed_len_callee(%[[VAL_6]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>>) -> () |
| 170 |
! CHECK: %[[VAL_13:.*]] = fir.rebox %[[VAL_9]]#1 : (!fir.box<!fir.array<?x!fir.char<1,2>>>) -> !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 171 |
! CHECK: fir.store %[[VAL_13]] to %[[VAL_5]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>> |
| 172 |
! CHECK: fir.call @_QPchar_assumed_shape_array_uclass_callee(%[[VAL_5]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>>) -> () |
| 173 |
! CHECK: %[[VAL_14:.*]] = fir.rebox %[[VAL_10]]#1 : (!fir.box<!fir.array<?x!fir.char<1,?>>>) -> !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>> |
| 174 |
! CHECK: fir.store %[[VAL_14]] to %[[VAL_4]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>>> |
| 175 |
! CHECK: fir.call @_QPchar_assumed_shape_array_explicit_len_callee(%[[VAL_4]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>>>) -> () |
| 176 |
! CHECK: %[[VAL_15:.*]] = fir.rebox %[[VAL_10]]#1 : (!fir.box<!fir.array<?x!fir.char<1,?>>>) -> !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>> |
| 177 |
! CHECK: fir.store %[[VAL_15]] to %[[VAL_3]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>> |
| 178 |
! CHECK: fir.call @_QPchar_assumed_shape_array_assumed_len_callee(%[[VAL_3]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>>) -> () |
| 179 |
! CHECK: %[[VAL_16:.*]] = fir.rebox %[[VAL_10]]#1 : (!fir.box<!fir.array<?x!fir.char<1,?>>>) -> !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 180 |
! CHECK: fir.store %[[VAL_16]] to %[[VAL_2]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>> |
| 181 |
! CHECK: fir.call @_QPchar_assumed_shape_array_uclass_callee(%[[VAL_2]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>>) -> () |
| 182 |
! CHECK: return |
| 183 |
! CHECK: } |
| 184 |
|
| 185 |
subroutine char_explicit_shape_array(a2) |
| 186 |
interface |
| 187 |
subroutine char_explicit_shape_array_explicit_len_callee(p) |
| 188 |
character(2), pointer, intent(in) :: p(:) |
| 189 |
end subroutine char_explicit_shape_array_explicit_len_callee |
| 190 |
subroutine char_explicit_shape_array_assumed_len_callee(p) |
| 191 |
character(*), pointer, intent(in) :: p(:) |
| 192 |
end subroutine char_explicit_shape_array_assumed_len_callee |
| 193 |
subroutine char_explicit_shape_array_uclass_callee(p) |
| 194 |
class(*), pointer, intent(in) :: p(:) |
| 195 |
end subroutine char_explicit_shape_array_uclass_callee |
| 196 |
end interface |
| 197 |
character(2), target :: a1(100) |
| 198 |
character(*), target :: a2(100) |
| 199 |
call char_explicit_shape_array_explicit_len_callee(a1) |
| 200 |
call char_explicit_shape_array_assumed_len_callee(a1) |
| 201 |
call char_explicit_shape_array_uclass_callee(a1) |
| 202 |
call char_explicit_shape_array_explicit_len_callee(a2) |
| 203 |
call char_explicit_shape_array_assumed_len_callee(a2) |
| 204 |
call char_explicit_shape_array_uclass_callee(a2) |
| 205 |
end subroutine char_explicit_shape_array |
| 206 |
! CHECK-LABEL: func.func @_QPchar_explicit_shape_array( |
| 207 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.boxchar<1> {fir.bindc_name = "a2", fir.target}) { |
| 208 |
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 209 |
! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>> |
| 210 |
! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>> |
| 211 |
! CHECK: %[[VAL_4:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 212 |
! CHECK: %[[VAL_5:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>> |
| 213 |
! CHECK: %[[VAL_6:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>> |
| 214 |
! CHECK: %[[VAL_7:.*]] = arith.constant 2 : index |
| 215 |
! CHECK: %[[VAL_8:.*]] = arith.constant 100 : index |
| 216 |
! CHECK: %[[VAL_9:.*]] = fir.alloca !fir.array<100x!fir.char<1,2>> {bindc_name = "a1", fir.target, uniq_name = "_QFchar_explicit_shape_arrayEa1"} |
| 217 |
! CHECK: %[[VAL_10:.*]] = fir.shape %[[VAL_8]] : (index) -> !fir.shape<1> |
| 218 |
! CHECK: %[[VAL_11:.*]]:2 = hlfir.declare %[[VAL_9]](%[[VAL_10]]) typeparams %[[VAL_7]] {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFchar_explicit_shape_arrayEa1"} : (!fir.ref<!fir.array<100x!fir.char<1,2>>>, !fir.shape<1>, index) -> (!fir.ref<!fir.array<100x!fir.char<1,2>>>, !fir.ref<!fir.array<100x!fir.char<1,2>>>) |
| 219 |
! CHECK: %[[VAL_12:.*]]:2 = fir.unboxchar %[[VAL_0]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index) |
| 220 |
! CHECK: %[[VAL_13:.*]] = fir.convert %[[VAL_12]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.array<100x!fir.char<1,?>>> |
| 221 |
! CHECK: %[[VAL_14:.*]] = arith.constant 100 : index |
| 222 |
! CHECK: %[[VAL_15:.*]] = fir.shape %[[VAL_14]] : (index) -> !fir.shape<1> |
| 223 |
! CHECK: %[[VAL_16:.*]]:2 = hlfir.declare %[[VAL_13]](%[[VAL_15]]) typeparams %[[VAL_12]]#1 dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFchar_explicit_shape_arrayEa2"} : (!fir.ref<!fir.array<100x!fir.char<1,?>>>, !fir.shape<1>, index, !fir.dscope) -> (!fir.box<!fir.array<100x!fir.char<1,?>>>, !fir.ref<!fir.array<100x!fir.char<1,?>>>) |
| 224 |
! CHECK: %[[VAL_17:.*]] = fir.shape %[[VAL_8]] : (index) -> !fir.shape<1> |
| 225 |
! CHECK: %[[VAL_18:.*]] = fir.convert %[[VAL_11]]#1 : (!fir.ref<!fir.array<100x!fir.char<1,2>>>) -> !fir.ref<!fir.array<?x!fir.char<1,2>>> |
| 226 |
! CHECK: %[[VAL_19:.*]] = fir.embox %[[VAL_18]](%[[VAL_17]]) : (!fir.ref<!fir.array<?x!fir.char<1,2>>>, !fir.shape<1>) -> !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>> |
| 227 |
! CHECK: fir.store %[[VAL_19]] to %[[VAL_6]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>>> |
| 228 |
! CHECK: fir.call @_QPchar_explicit_shape_array_explicit_len_callee(%[[VAL_6]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>>>) -> () |
| 229 |
! CHECK: %[[VAL_20:.*]] = fir.shape %[[VAL_8]] : (index) -> !fir.shape<1> |
| 230 |
! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_11]]#1 : (!fir.ref<!fir.array<100x!fir.char<1,2>>>) -> !fir.ref<!fir.array<?x!fir.char<1,?>>> |
| 231 |
! CHECK: %[[VAL_22:.*]] = fir.embox %[[VAL_21]](%[[VAL_20]]) typeparams %[[VAL_7]] : (!fir.ref<!fir.array<?x!fir.char<1,?>>>, !fir.shape<1>, index) -> !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>> |
| 232 |
! CHECK: fir.store %[[VAL_22]] to %[[VAL_5]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>> |
| 233 |
! CHECK: fir.call @_QPchar_explicit_shape_array_assumed_len_callee(%[[VAL_5]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>>) -> () |
| 234 |
! CHECK: %[[VAL_23:.*]] = fir.shape %[[VAL_8]] : (index) -> !fir.shape<1> |
| 235 |
! CHECK: %[[VAL_24:.*]] = fir.embox %[[VAL_11]]#1(%[[VAL_23]]) : (!fir.ref<!fir.array<100x!fir.char<1,2>>>, !fir.shape<1>) -> !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 236 |
! CHECK: fir.store %[[VAL_24]] to %[[VAL_4]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>> |
| 237 |
! CHECK: fir.call @_QPchar_explicit_shape_array_uclass_callee(%[[VAL_4]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>>) -> () |
| 238 |
! CHECK: %[[VAL_25:.*]] = fir.shape %[[VAL_14]] : (index) -> !fir.shape<1> |
| 239 |
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_16]]#1 : (!fir.ref<!fir.array<100x!fir.char<1,?>>>) -> !fir.ref<!fir.array<?x!fir.char<1,2>>> |
| 240 |
! CHECK: %[[VAL_27:.*]] = fir.embox %[[VAL_26]](%[[VAL_25]]) : (!fir.ref<!fir.array<?x!fir.char<1,2>>>, !fir.shape<1>) -> !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>> |
| 241 |
! CHECK: fir.store %[[VAL_27]] to %[[VAL_3]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>>> |
| 242 |
! CHECK: fir.call @_QPchar_explicit_shape_array_explicit_len_callee(%[[VAL_3]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,2>>>>>) -> () |
| 243 |
! CHECK: %[[VAL_28:.*]] = fir.shape %[[VAL_14]] : (index) -> !fir.shape<1> |
| 244 |
! CHECK: %[[VAL_29:.*]] = fir.convert %[[VAL_16]]#1 : (!fir.ref<!fir.array<100x!fir.char<1,?>>>) -> !fir.ref<!fir.array<?x!fir.char<1,?>>> |
| 245 |
! CHECK: %[[VAL_30:.*]] = fir.embox %[[VAL_29]](%[[VAL_28]]) typeparams %[[VAL_12]]#1 : (!fir.ref<!fir.array<?x!fir.char<1,?>>>, !fir.shape<1>, index) -> !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>> |
| 246 |
! CHECK: fir.store %[[VAL_30]] to %[[VAL_2]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>> |
| 247 |
! CHECK: fir.call @_QPchar_explicit_shape_array_assumed_len_callee(%[[VAL_2]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>>) -> () |
| 248 |
! CHECK: %[[VAL_31:.*]] = fir.shape %[[VAL_14]] : (index) -> !fir.shape<1> |
| 249 |
! CHECK: %[[VAL_32:.*]] = fir.embox %[[VAL_16]]#1(%[[VAL_31]]) : (!fir.ref<!fir.array<100x!fir.char<1,?>>>, !fir.shape<1>) -> !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 250 |
! CHECK: fir.store %[[VAL_32]] to %[[VAL_1]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>> |
| 251 |
! CHECK: fir.call @_QPchar_explicit_shape_array_uclass_callee(%[[VAL_1]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>>) -> () |
| 252 |
! CHECK: return |
| 253 |
! CHECK: } |
| 254 |
|
| 255 |
subroutine type_scalar() |
| 256 |
use target_to_pointer_types |
| 257 |
interface |
| 258 |
subroutine type_scalar_callee(p) |
| 259 |
use target_to_pointer_types |
| 260 |
type(t1), pointer, intent(in) :: p |
| 261 |
end subroutine type_scalar_callee |
| 262 |
subroutine type_scalar_class_callee(p) |
| 263 |
use target_to_pointer_types |
| 264 |
class(t1), pointer, intent(in) :: p |
| 265 |
end subroutine type_scalar_class_callee |
| 266 |
subroutine type_scalar_uclass_callee(p) |
| 267 |
use target_to_pointer_types |
| 268 |
class(*), pointer, intent(in) :: p |
| 269 |
end subroutine type_scalar_uclass_callee |
| 270 |
end interface |
| 271 |
type(t1), target :: t |
| 272 |
call type_scalar_callee(t) |
| 273 |
call type_scalar_class_callee(t) |
| 274 |
call type_scalar_uclass_callee(t) |
| 275 |
end subroutine type_scalar |
| 276 |
! CHECK-LABEL: func.func @_QPtype_scalar() { |
| 277 |
! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.class<!fir.ptr<none>> |
| 278 |
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>> |
| 279 |
! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>> |
| 280 |
! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.type<_QMtarget_to_pointer_typesTt1> {bindc_name = "t", fir.target, uniq_name = "_QFtype_scalarEt"} |
| 281 |
! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[VAL_3]] {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFtype_scalarEt"} : (!fir.ref<!fir.type<_QMtarget_to_pointer_typesTt1>>) -> (!fir.ref<!fir.type<_QMtarget_to_pointer_typesTt1>>, !fir.ref<!fir.type<_QMtarget_to_pointer_typesTt1>>) |
| 282 |
! CHECK: %[[VAL_5:.*]] = fir.embox %[[VAL_4]]#1 : (!fir.ref<!fir.type<_QMtarget_to_pointer_typesTt1>>) -> !fir.box<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>> |
| 283 |
! CHECK: fir.store %[[VAL_5]] to %[[VAL_2]] : !fir.ref<!fir.box<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 284 |
! CHECK: fir.call @_QPtype_scalar_callee(%[[VAL_2]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>>>) -> () |
| 285 |
! CHECK: %[[VAL_6:.*]] = fir.embox %[[VAL_4]]#1 : (!fir.ref<!fir.type<_QMtarget_to_pointer_typesTt1>>) -> !fir.class<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>> |
| 286 |
! CHECK: fir.store %[[VAL_6]] to %[[VAL_1]] : !fir.ref<!fir.class<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 287 |
! CHECK: fir.call @_QPtype_scalar_class_callee(%[[VAL_1]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>>>) -> () |
| 288 |
! CHECK: %[[VAL_7:.*]] = fir.embox %[[VAL_4]]#1 : (!fir.ref<!fir.type<_QMtarget_to_pointer_typesTt1>>) -> !fir.class<!fir.ptr<none>> |
| 289 |
! CHECK: fir.store %[[VAL_7]] to %[[VAL_0]] : !fir.ref<!fir.class<!fir.ptr<none>>> |
| 290 |
! CHECK: fir.call @_QPtype_scalar_uclass_callee(%[[VAL_0]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<none>>>) -> () |
| 291 |
! CHECK: return |
| 292 |
! CHECK: } |
| 293 |
|
| 294 |
subroutine type_assumed_shape_array(t) |
| 295 |
use target_to_pointer_types |
| 296 |
interface |
| 297 |
subroutine type_assumed_shape_array_callee(p) |
| 298 |
use target_to_pointer_types |
| 299 |
type(t1), pointer, intent(in) :: p(:) |
| 300 |
end subroutine type_assumed_shape_array_callee |
| 301 |
subroutine type_assumed_shape_array_class_callee(p) |
| 302 |
use target_to_pointer_types |
| 303 |
class(t1), pointer, intent(in) :: p(:) |
| 304 |
end subroutine type_assumed_shape_array_class_callee |
| 305 |
subroutine type_assumed_shape_array_uclass_callee(p) |
| 306 |
use target_to_pointer_types |
| 307 |
class(*), pointer, intent(in) :: p(:) |
| 308 |
end subroutine type_assumed_shape_array_uclass_callee |
| 309 |
end interface |
| 310 |
type(t1), target :: t(:) |
| 311 |
call type_assumed_shape_array_callee(t) |
| 312 |
call type_assumed_shape_array_class_callee(t) |
| 313 |
call type_assumed_shape_array_uclass_callee(t) |
| 314 |
end subroutine type_assumed_shape_array |
| 315 |
! CHECK-LABEL: func.func @_QPtype_assumed_shape_array( |
| 316 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>> {fir.bindc_name = "t", fir.target}) { |
| 317 |
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 318 |
! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 319 |
! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 320 |
! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFtype_assumed_shape_arrayEt"} : (!fir.box<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>, !fir.dscope) -> (!fir.box<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>, !fir.box<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>) |
| 321 |
! CHECK: %[[VAL_5:.*]] = fir.rebox %[[VAL_4]]#1 : (!fir.box<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>) -> !fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 322 |
! CHECK: fir.store %[[VAL_5]] to %[[VAL_3]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>> |
| 323 |
! CHECK: fir.call @_QPtype_assumed_shape_array_callee(%[[VAL_3]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>>) -> () |
| 324 |
! CHECK: %[[VAL_6:.*]] = fir.rebox %[[VAL_4]]#1 : (!fir.box<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>) -> !fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 325 |
! CHECK: fir.store %[[VAL_6]] to %[[VAL_2]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>> |
| 326 |
! CHECK: fir.call @_QPtype_assumed_shape_array_class_callee(%[[VAL_2]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>>) -> () |
| 327 |
! CHECK: %[[VAL_7:.*]] = fir.rebox %[[VAL_4]]#1 : (!fir.box<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>) -> !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 328 |
! CHECK: fir.store %[[VAL_7]] to %[[VAL_1]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>> |
| 329 |
! CHECK: fir.call @_QPtype_assumed_shape_array_uclass_callee(%[[VAL_1]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>>) -> () |
| 330 |
! CHECK: return |
| 331 |
! CHECK: } |
| 332 |
|
| 333 |
subroutine type_explicit_shape_array() |
| 334 |
use target_to_pointer_types |
| 335 |
interface |
| 336 |
subroutine type_explicit_shape_array_callee(p) |
| 337 |
use target_to_pointer_types |
| 338 |
type(t1), pointer, intent(in) :: p(:) |
| 339 |
end subroutine type_explicit_shape_array_callee |
| 340 |
subroutine type_explicit_shape_array_class_callee(p) |
| 341 |
use target_to_pointer_types |
| 342 |
class(t1), pointer, intent(in) :: p(:) |
| 343 |
end subroutine type_explicit_shape_array_class_callee |
| 344 |
subroutine type_explicit_shape_array_uclass_callee(p) |
| 345 |
use target_to_pointer_types |
| 346 |
class(*), pointer, intent(in) :: p(:) |
| 347 |
end subroutine type_explicit_shape_array_uclass_callee |
| 348 |
end interface |
| 349 |
type(t1), target :: t(100) |
| 350 |
call type_explicit_shape_array_callee(t) |
| 351 |
call type_explicit_shape_array_class_callee(t) |
| 352 |
call type_explicit_shape_array_uclass_callee(t) |
| 353 |
end subroutine type_explicit_shape_array |
| 354 |
! CHECK-LABEL: func.func @_QPtype_explicit_shape_array() { |
| 355 |
! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 356 |
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 357 |
! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 358 |
! CHECK: %[[VAL_3:.*]] = arith.constant 100 : index |
| 359 |
! CHECK: %[[VAL_4:.*]] = fir.alloca !fir.array<100x!fir.type<_QMtarget_to_pointer_typesTt1>> {bindc_name = "t", fir.target, uniq_name = "_QFtype_explicit_shape_arrayEt"} |
| 360 |
! CHECK: %[[VAL_5:.*]] = fir.shape %[[VAL_3]] : (index) -> !fir.shape<1> |
| 361 |
! CHECK: %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_4]](%[[VAL_5]]) {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFtype_explicit_shape_arrayEt"} : (!fir.ref<!fir.array<100x!fir.type<_QMtarget_to_pointer_typesTt1>>>, !fir.shape<1>) -> (!fir.ref<!fir.array<100x!fir.type<_QMtarget_to_pointer_typesTt1>>>, !fir.ref<!fir.array<100x!fir.type<_QMtarget_to_pointer_typesTt1>>>) |
| 362 |
! CHECK: %[[VAL_7:.*]] = fir.shape %[[VAL_3]] : (index) -> !fir.shape<1> |
| 363 |
! CHECK: %[[VAL_8:.*]] = fir.embox %[[VAL_6]]#1(%[[VAL_7]]) : (!fir.ref<!fir.array<100x!fir.type<_QMtarget_to_pointer_typesTt1>>>, !fir.shape<1>) -> !fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 364 |
! CHECK: fir.store %[[VAL_8]] to %[[VAL_2]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>> |
| 365 |
! CHECK: fir.call @_QPtype_explicit_shape_array_callee(%[[VAL_2]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>>) -> () |
| 366 |
! CHECK: %[[VAL_9:.*]] = fir.shape %[[VAL_3]] : (index) -> !fir.shape<1> |
| 367 |
! CHECK: %[[VAL_10:.*]] = fir.embox %[[VAL_6]]#1(%[[VAL_9]]) : (!fir.ref<!fir.array<100x!fir.type<_QMtarget_to_pointer_typesTt1>>>, !fir.shape<1>) -> !fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 368 |
! CHECK: fir.store %[[VAL_10]] to %[[VAL_1]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>> |
| 369 |
! CHECK: fir.call @_QPtype_explicit_shape_array_class_callee(%[[VAL_1]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>>) -> () |
| 370 |
! CHECK: %[[VAL_11:.*]] = fir.shape %[[VAL_3]] : (index) -> !fir.shape<1> |
| 371 |
! CHECK: %[[VAL_12:.*]] = fir.embox %[[VAL_6]]#1(%[[VAL_11]]) : (!fir.ref<!fir.array<100x!fir.type<_QMtarget_to_pointer_typesTt1>>>, !fir.shape<1>) -> !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 372 |
! CHECK: fir.store %[[VAL_12]] to %[[VAL_0]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>> |
| 373 |
! CHECK: fir.call @_QPtype_explicit_shape_array_uclass_callee(%[[VAL_0]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>>) -> () |
| 374 |
! CHECK: return |
| 375 |
! CHECK: } |
| 376 |
|
| 377 |
subroutine class_scalar(t) |
| 378 |
use target_to_pointer_types |
| 379 |
interface |
| 380 |
subroutine class_scalar_callee(p) |
| 381 |
use target_to_pointer_types |
| 382 |
type(t1), pointer, intent(in) :: p |
| 383 |
end subroutine class_scalar_callee |
| 384 |
subroutine class_scalar_class_callee(p) |
| 385 |
use target_to_pointer_types |
| 386 |
class(t1), pointer, intent(in) :: p |
| 387 |
end subroutine class_scalar_class_callee |
| 388 |
subroutine class_scalar_uclass_callee(p) |
| 389 |
use target_to_pointer_types |
| 390 |
class(*), pointer, intent(in) :: p |
| 391 |
end subroutine class_scalar_uclass_callee |
| 392 |
end interface |
| 393 |
class(t1), target :: t |
| 394 |
call class_scalar_callee(t) |
| 395 |
call class_scalar_class_callee(t) |
| 396 |
call class_scalar_uclass_callee(t) |
| 397 |
end subroutine class_scalar |
| 398 |
! CHECK-LABEL: func.func @_QPclass_scalar( |
| 399 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.class<!fir.type<_QMtarget_to_pointer_typesTt1>> {fir.bindc_name = "t", fir.target}) { |
| 400 |
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.class<!fir.ptr<none>> |
| 401 |
! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>> |
| 402 |
! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>> |
| 403 |
! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFclass_scalarEt"} : (!fir.class<!fir.type<_QMtarget_to_pointer_typesTt1>>, !fir.dscope) -> (!fir.class<!fir.type<_QMtarget_to_pointer_typesTt1>>, !fir.class<!fir.type<_QMtarget_to_pointer_typesTt1>>) |
| 404 |
! CHECK: %[[VAL_5:.*]] = fir.rebox %[[VAL_4]]#1 : (!fir.class<!fir.type<_QMtarget_to_pointer_typesTt1>>) -> !fir.box<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>> |
| 405 |
! CHECK: fir.store %[[VAL_5]] to %[[VAL_3]] : !fir.ref<!fir.box<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 406 |
! CHECK: fir.call @_QPclass_scalar_callee(%[[VAL_3]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>>>) -> () |
| 407 |
! CHECK: %[[VAL_6:.*]] = fir.rebox %[[VAL_4]]#1 : (!fir.class<!fir.type<_QMtarget_to_pointer_typesTt1>>) -> !fir.class<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>> |
| 408 |
! CHECK: fir.store %[[VAL_6]] to %[[VAL_2]] : !fir.ref<!fir.class<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 409 |
! CHECK: fir.call @_QPclass_scalar_class_callee(%[[VAL_2]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.type<_QMtarget_to_pointer_typesTt1>>>>) -> () |
| 410 |
! CHECK: %[[VAL_7:.*]] = fir.rebox %[[VAL_4]]#1 : (!fir.class<!fir.type<_QMtarget_to_pointer_typesTt1>>) -> !fir.class<!fir.ptr<none>> |
| 411 |
! CHECK: fir.store %[[VAL_7]] to %[[VAL_1]] : !fir.ref<!fir.class<!fir.ptr<none>>> |
| 412 |
! CHECK: fir.call @_QPclass_scalar_uclass_callee(%[[VAL_1]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<none>>>) -> () |
| 413 |
! CHECK: return |
| 414 |
! CHECK: } |
| 415 |
|
| 416 |
subroutine class_assumed_shape_array(t) |
| 417 |
use target_to_pointer_types |
| 418 |
interface |
| 419 |
subroutine class_assumed_shape_array_callee(p) |
| 420 |
use target_to_pointer_types |
| 421 |
type(t1), pointer, intent(in) :: p(:) |
| 422 |
end subroutine class_assumed_shape_array_callee |
| 423 |
subroutine class_assumed_shape_array_class_callee(p) |
| 424 |
use target_to_pointer_types |
| 425 |
class(t1), pointer, intent(in) :: p(:) |
| 426 |
end subroutine class_assumed_shape_array_class_callee |
| 427 |
subroutine class_assumed_shape_array_uclass_callee(p) |
| 428 |
use target_to_pointer_types |
| 429 |
class(*), pointer, intent(in) :: p(:) |
| 430 |
end subroutine class_assumed_shape_array_uclass_callee |
| 431 |
end interface |
| 432 |
class(t1), target :: t(:) |
| 433 |
call class_assumed_shape_array_callee(t) |
| 434 |
call class_assumed_shape_array_class_callee(t) |
| 435 |
call class_assumed_shape_array_uclass_callee(t) |
| 436 |
end subroutine class_assumed_shape_array |
| 437 |
! CHECK-LABEL: func.func @_QPclass_assumed_shape_array( |
| 438 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.class<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>> {fir.bindc_name = "t", fir.target}) { |
| 439 |
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 440 |
! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 441 |
! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 442 |
! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFclass_assumed_shape_arrayEt"} : (!fir.class<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>, !fir.dscope) -> (!fir.class<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>, !fir.class<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>) |
| 443 |
! CHECK: %[[VAL_5:.*]] = fir.rebox %[[VAL_4]]#1 : (!fir.class<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>) -> !fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 444 |
! CHECK: fir.store %[[VAL_5]] to %[[VAL_3]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>> |
| 445 |
! CHECK: fir.call @_QPclass_assumed_shape_array_callee(%[[VAL_3]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>>) -> () |
| 446 |
! CHECK: %[[VAL_6:.*]] = fir.rebox %[[VAL_4]]#1 : (!fir.class<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>) -> !fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 447 |
! CHECK: fir.store %[[VAL_6]] to %[[VAL_2]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>> |
| 448 |
! CHECK: fir.call @_QPclass_assumed_shape_array_class_callee(%[[VAL_2]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>>) -> () |
| 449 |
! CHECK: %[[VAL_7:.*]] = fir.rebox %[[VAL_4]]#1 : (!fir.class<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>) -> !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 450 |
! CHECK: fir.store %[[VAL_7]] to %[[VAL_1]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>> |
| 451 |
! CHECK: fir.call @_QPclass_assumed_shape_array_uclass_callee(%[[VAL_1]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>>) -> () |
| 452 |
! CHECK: return |
| 453 |
! CHECK: } |
| 454 |
|
| 455 |
subroutine class_explicit_shape_array(t) |
| 456 |
use target_to_pointer_types |
| 457 |
interface |
| 458 |
subroutine class_explicit_shape_array_callee(p) |
| 459 |
use target_to_pointer_types |
| 460 |
type(t1), pointer, intent(in) :: p(:) |
| 461 |
end subroutine class_explicit_shape_array_callee |
| 462 |
subroutine class_explicit_shape_array_class_callee(p) |
| 463 |
use target_to_pointer_types |
| 464 |
class(t1), pointer, intent(in) :: p(:) |
| 465 |
end subroutine class_explicit_shape_array_class_callee |
| 466 |
subroutine class_explicit_shape_array_uclass_callee(p) |
| 467 |
use target_to_pointer_types |
| 468 |
class(*), pointer, intent(in) :: p(:) |
| 469 |
end subroutine class_explicit_shape_array_uclass_callee |
| 470 |
end interface |
| 471 |
class(t1), target :: t(100) |
| 472 |
call class_explicit_shape_array_callee(t) |
| 473 |
call class_explicit_shape_array_class_callee(t) |
| 474 |
call class_explicit_shape_array_uclass_callee(t) |
| 475 |
end subroutine class_explicit_shape_array |
| 476 |
! CHECK-LABEL: func.func @_QPclass_explicit_shape_array( |
| 477 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.class<!fir.array<100x!fir.type<_QMtarget_to_pointer_typesTt1>>> {fir.bindc_name = "t", fir.target}) { |
| 478 |
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 479 |
! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 480 |
! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 481 |
! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFclass_explicit_shape_arrayEt"} : (!fir.class<!fir.array<100x!fir.type<_QMtarget_to_pointer_typesTt1>>>, !fir.dscope) -> (!fir.class<!fir.array<100x!fir.type<_QMtarget_to_pointer_typesTt1>>>, !fir.class<!fir.array<100x!fir.type<_QMtarget_to_pointer_typesTt1>>>) |
| 482 |
! CHECK: %[[VAL_5:.*]] = fir.rebox %[[VAL_4]]#1 : (!fir.class<!fir.array<100x!fir.type<_QMtarget_to_pointer_typesTt1>>>) -> !fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 483 |
! CHECK: fir.store %[[VAL_5]] to %[[VAL_3]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>> |
| 484 |
! CHECK: fir.call @_QPclass_explicit_shape_array_callee(%[[VAL_3]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>>) -> () |
| 485 |
! CHECK: %[[VAL_6:.*]] = fir.rebox %[[VAL_4]]#1 : (!fir.class<!fir.array<100x!fir.type<_QMtarget_to_pointer_typesTt1>>>) -> !fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>> |
| 486 |
! CHECK: fir.store %[[VAL_6]] to %[[VAL_2]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>> |
| 487 |
! CHECK: fir.call @_QPclass_explicit_shape_array_class_callee(%[[VAL_2]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?x!fir.type<_QMtarget_to_pointer_typesTt1>>>>>) -> () |
| 488 |
! CHECK: %[[VAL_7:.*]] = fir.rebox %[[VAL_4]]#1 : (!fir.class<!fir.array<100x!fir.type<_QMtarget_to_pointer_typesTt1>>>) -> !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 489 |
! CHECK: fir.store %[[VAL_7]] to %[[VAL_1]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>> |
| 490 |
! CHECK: fir.call @_QPclass_explicit_shape_array_uclass_callee(%[[VAL_1]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>>) -> () |
| 491 |
! CHECK: return |
| 492 |
! CHECK: } |
| 493 |
|
| 494 |
subroutine uclass_scalar(t) |
| 495 |
use target_to_pointer_types |
| 496 |
interface |
| 497 |
subroutine uclass_scalar_uclass_callee(p) |
| 498 |
use target_to_pointer_types |
| 499 |
class(*), pointer, intent(in) :: p |
| 500 |
end subroutine uclass_scalar_uclass_callee |
| 501 |
end interface |
| 502 |
class(*), target :: t |
| 503 |
call uclass_scalar_uclass_callee(t) |
| 504 |
end subroutine uclass_scalar |
| 505 |
! CHECK-LABEL: func.func @_QPuclass_scalar( |
| 506 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.class<none> {fir.bindc_name = "t", fir.target}) { |
| 507 |
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.class<!fir.ptr<none>> |
| 508 |
! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFuclass_scalarEt"} : (!fir.class<none>, !fir.dscope) -> (!fir.class<none>, !fir.class<none>) |
| 509 |
! CHECK: %[[VAL_3:.*]] = fir.rebox %[[VAL_2]]#1 : (!fir.class<none>) -> !fir.class<!fir.ptr<none>> |
| 510 |
! CHECK: fir.store %[[VAL_3]] to %[[VAL_1]] : !fir.ref<!fir.class<!fir.ptr<none>>> |
| 511 |
! CHECK: fir.call @_QPuclass_scalar_uclass_callee(%[[VAL_1]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<none>>>) -> () |
| 512 |
! CHECK: return |
| 513 |
! CHECK: } |
| 514 |
|
| 515 |
subroutine uclass_assumed_shape_array(t) |
| 516 |
use target_to_pointer_types |
| 517 |
interface |
| 518 |
subroutine uclass_assumed_shape_array_uclass_callee(p) |
| 519 |
use target_to_pointer_types |
| 520 |
class(*), pointer, intent(in) :: p(:) |
| 521 |
end subroutine uclass_assumed_shape_array_uclass_callee |
| 522 |
end interface |
| 523 |
class(*), target :: t(:) |
| 524 |
call uclass_assumed_shape_array_uclass_callee(t) |
| 525 |
end subroutine uclass_assumed_shape_array |
| 526 |
! CHECK-LABEL: func.func @_QPuclass_assumed_shape_array( |
| 527 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.class<!fir.array<?xnone>> {fir.bindc_name = "t", fir.target}) { |
| 528 |
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 529 |
! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFuclass_assumed_shape_arrayEt"} : (!fir.class<!fir.array<?xnone>>, !fir.dscope) -> (!fir.class<!fir.array<?xnone>>, !fir.class<!fir.array<?xnone>>) |
| 530 |
! CHECK: %[[VAL_3:.*]] = fir.rebox %[[VAL_2]]#1 : (!fir.class<!fir.array<?xnone>>) -> !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 531 |
! CHECK: fir.store %[[VAL_3]] to %[[VAL_1]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>> |
| 532 |
! CHECK: fir.call @_QPuclass_assumed_shape_array_uclass_callee(%[[VAL_1]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>>) -> () |
| 533 |
! CHECK: return |
| 534 |
! CHECK: } |
| 535 |
|
| 536 |
subroutine uclass_explicit_shape_array(t) |
| 537 |
use target_to_pointer_types |
| 538 |
interface |
| 539 |
subroutine uclass_explicit_shape_array_uclass_callee(p) |
| 540 |
use target_to_pointer_types |
| 541 |
class(*), pointer, intent(in) :: p(:) |
| 542 |
end subroutine uclass_explicit_shape_array_uclass_callee |
| 543 |
end interface |
| 544 |
class(*), target :: t(100) |
| 545 |
call uclass_explicit_shape_array_uclass_callee(t) |
| 546 |
end subroutine uclass_explicit_shape_array |
| 547 |
! CHECK-LABEL: func.func @_QPuclass_explicit_shape_array( |
| 548 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.class<!fir.array<100xnone>> {fir.bindc_name = "t", fir.target}) { |
| 549 |
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 550 |
! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFuclass_explicit_shape_arrayEt"} : (!fir.class<!fir.array<100xnone>>, !fir.dscope) -> (!fir.class<!fir.array<100xnone>>, !fir.class<!fir.array<100xnone>>) |
| 551 |
! CHECK: %[[VAL_3:.*]] = fir.rebox %[[VAL_2]]#1 : (!fir.class<!fir.array<100xnone>>) -> !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 552 |
! CHECK: fir.store %[[VAL_3]] to %[[VAL_1]] : !fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>> |
| 553 |
! CHECK: fir.call @_QPuclass_explicit_shape_array_uclass_callee(%[[VAL_1]]) fastmath<contract> : (!fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>>) -> () |
| 554 |
! CHECK: return |
| 555 |
! CHECK: } |