1 ! RUN: bbc -emit-fir -hlfir=false %s -o - | fir-opt --fir-polymorphic-op | FileCheck %s
8 type, extends(p1
) :: p2
12 type, extends(p2
) :: p3
18 subroutine select_type1(a
)
19 class(p1
), intent(in
) :: a
31 ! CHECK-LABEL: func.func @_QMselect_type_2Pselect_type1(
32 ! CHECK-SAME: %[[ARG0:.*]]: !fir.class<!fir.type<_QMselect_type_2Tp1{a:i32,b:i32}>> {fir.bindc_name = "a"}) {
33 ! CHECK: %[[TDESC_P3_ADDR:.*]] = fir.address_of(@_QMselect_type_2E.dt.p3) : !fir.ref<!fir.type<{{.*}}>>
34 ! CHECK: %[[TDESC_P3_CONV:.*]] = fir.convert %[[TDESC_P3_ADDR]] : (!fir.ref<!fir.type<{{.*}}>>) -> !fir.ref<none>
35 ! CHECK: %[[BOX_NONE:.*]] = fir.convert %[[ARG0]] : (!fir.class<!fir.type<_QMselect_type_2Tp1{a:i32,b:i32}>>) -> !fir.box<none>
36 ! CHECK: %[[CLASS_IS_CMP:.*]] = fir.call @_FortranAClassIs(%[[BOX_NONE]], %[[TDESC_P3_CONV]]) : (!fir.box<none>, !fir.ref<none>) -> i1
37 ! CHECK: cf.cond_br %[[CLASS_IS_CMP]], ^[[CLASS_IS_P3_BLK:.*]], ^[[NOT_CLASS_IS_P3_BLK:.*]]
38 ! CHECK: ^bb[[NOT_CLASS_IS_P1:[0-9]]]:
39 ! CHECK: cf.br ^bb[[DEFAULT_BLK:[0-9]]]
40 ! CHECK: ^bb[[CLASS_IS_P1:[0-9]]]:
41 ! CHECK: cf.br ^bb[[END_SELECT_BLK:[0-9]]]
42 ! CHECK: ^[[NOT_CLASS_IS_P3_BLK]]:
43 ! CHECK: %[[TDESC_P1_ADDR:.*]] = fir.address_of(@_QMselect_type_2E.dt.p1) : !fir.ref<!fir.type<{{.*}}>>
44 ! CHECK: %[[TDESC_P1_CONV:.*]] = fir.convert %[[TDESC_P1_ADDR]] : (!fir.ref<!fir.type<{{.*}}>>) -> !fir.ref<none>
45 ! CHECK: %[[BOX_NONE:.*]] = fir.convert %[[ARG0]] : (!fir.class<!fir.type<_QMselect_type_2Tp1{a:i32,b:i32}>>) -> !fir.box<none>
46 ! CHECK: %[[CLASS_IS_CMP:.*]] = fir.call @_FortranAClassIs(%[[BOX_NONE]], %[[TDESC_P1_CONV]]) : (!fir.box<none>, !fir.ref<none>) -> i1
47 ! CHECK: cf.cond_br %[[CLASS_IS_CMP]], ^bb[[CLASS_IS_P1]], ^bb[[NOT_CLASS_IS_P1]]
48 ! CHECK: ^[[CLASS_IS_P3_BLK]]:
49 ! CHECK: cf.br ^bb[[END_SELECT_BLK]]
50 ! CHECK: ^bb[[DEFAULT_BLK]]:
51 ! CHECK: cf.br ^bb[[END_SELECT_BLK]]
52 ! CHECK: ^bb[[END_SELECT_BLK]]: