| 1 |
! Test passing polymorphic variable for non-polymorphic dummy arguments: |
| 2 |
! RUN: bbc -emit-hlfir -o - -I nowhere %s | FileCheck %s |
| 3 |
|
| 4 |
subroutine test_sequence_association(x) |
| 5 |
type t |
| 6 |
integer :: i |
| 7 |
end type |
| 8 |
interface |
| 9 |
subroutine sequence_assoc(x, n) |
| 10 |
import :: t |
| 11 |
type(t) :: x(n) |
| 12 |
end subroutine |
| 13 |
end interface |
| 14 |
class(t) :: x(:, :) |
| 15 |
call sequence_assoc(x, 100) |
| 16 |
end subroutine |
| 17 |
! CHECK-LABEL: func.func @_QPtest_sequence_association( |
| 18 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.class<!fir.array<?x?x!fir.type<_QFtest_sequence_associationTt{i:i32}>>> |
| 19 |
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x?x!fir.type<_QFtest_sequence_associationTt{i:i32}>>>> |
| 20 |
! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_0]] |
| 21 |
! CHECK: %[[REBOX:.*]] = fir.rebox %[[VAL_3]]#0 : (!fir.class<!fir.array<?x?x!fir.type<_QFtest_sequence_associationTt{i:i32}>>>) -> !fir.box<!fir.array<?x?x!fir.type<_QFtest_sequence_associationTt{i:i32}>>> |
| 22 |
! CHECK: %[[VAL_5:.*]]:2 = hlfir.copy_in %[[REBOX]] to %[[VAL_1]] : (!fir.box<!fir.array<?x?x!fir.type<_QFtest_sequence_associationTt{i:i32}>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?x?x!fir.type<_QFtest_sequence_associationTt{i:i32}>>>>>) -> (!fir.box<!fir.array<?x?x!fir.type<_QFtest_sequence_associationTt{i:i32}>>>, i1) |
| 23 |
! CHECK: %[[VAL_6:.*]] = fir.box_addr %[[VAL_5]]#0 : (!fir.box<!fir.array<?x?x!fir.type<_QFtest_sequence_associationTt{i:i32}>>>) -> !fir.ref<!fir.array<?x?x!fir.type<_QFtest_sequence_associationTt{i:i32}>>> |
| 24 |
! CHECK: %[[VAL_7:.*]] = fir.convert %[[VAL_6]] : (!fir.ref<!fir.array<?x?x!fir.type<_QFtest_sequence_associationTt{i:i32}>>>) -> !fir.ref<!fir.array<?x!fir.type<_QFtest_sequence_associationTt{i:i32}>>> |
| 25 |
! CHECK: fir.call @_QPsequence_assoc(%[[VAL_7]], %{{.*}}) |
| 26 |
! CHECK: hlfir.copy_out %[[VAL_1]], %[[VAL_5]]#1 to %[[REBOX]] : (!fir.ref<!fir.box<!fir.heap<!fir.array<?x?x!fir.type<_QFtest_sequence_associationTt{i:i32}>>>>>, i1, !fir.box<!fir.array<?x?x!fir.type<_QFtest_sequence_associationTt{i:i32}>>>) -> () |