| 1 |
! Test passing rank 2 CLASS(*) deferred shape to assumed size assumed type |
| 2 |
! This requires copy-in/copy-out logic. |
| 3 |
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s |
| 4 |
|
| 5 |
subroutine pass_poly_to_assumed_type_assumed_size(x) |
| 6 |
class(*), target :: x(:,:) |
| 7 |
interface |
| 8 |
subroutine assumed_type_assumed_size(x) |
| 9 |
type(*), target :: x(*) |
| 10 |
end subroutine |
| 11 |
end interface |
| 12 |
call assumed_type_assumed_size(x) |
| 13 |
end subroutine |
| 14 |
! CHECK-LABEL: func.func @_QPpass_poly_to_assumed_type_assumed_size( |
| 15 |
! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0:[a-z0-9]*]] dummy_scope %{{[0-9]+}} {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFpass_poly_to_assumed_type_assumed_sizeEx"} : (!fir.class<!fir.array<?x?xnone>>, !fir.dscope) -> (!fir.class<!fir.array<?x?xnone>>, !fir.class<!fir.array<?x?xnone>>) |
| 16 |
! CHECK: %[[VAL_2:.*]]:2 = hlfir.copy_in %[[VAL_1]]#0 to %[[TMP_BOX:.*]] : (!fir.class<!fir.array<?x?xnone>>, !fir.ref<!fir.class<!fir.heap<!fir.array<?x?xnone>>>>) -> (!fir.class<!fir.array<?x?xnone>>, i1) |
| 17 |
! CHECK: %[[VAL_3:.*]] = fir.box_addr %[[VAL_2]]#0 : (!fir.class<!fir.array<?x?xnone>>) -> !fir.ref<!fir.array<?x?xnone>> |
| 18 |
! CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_3]] : (!fir.ref<!fir.array<?x?xnone>>) -> !fir.ref<!fir.array<?xnone>> |
| 19 |
! CHECK: fir.call @_QPassumed_type_assumed_size(%[[VAL_4]]) fastmath<contract> : (!fir.ref<!fir.array<?xnone>>) -> () |
| 20 |
! CHECK: hlfir.copy_out %[[TMP_BOX]], %[[VAL_2]]#1 to %[[VAL_1]]#0 : (!fir.ref<!fir.class<!fir.heap<!fir.array<?x?xnone>>>>, i1, !fir.class<!fir.array<?x?xnone>>) -> () |