1 ! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
3 module assumed_type_test
7 type(*), intent(in
), target
:: a
12 subroutine assumed_r(a
)
13 type(*), intent(in
), target
:: a(*)
19 subroutine call_assumed()
24 ! CHECK-LABEL: func.func @_QMassumed_type_testPcall_assumed() {
25 ! CHECK: %[[I:.*]] = fir.alloca i32 {bindc_name = "i", fir.target, uniq_name = "_QMassumed_type_testFcall_assumedEi"}
26 ! CHECK: %[[CONV:.*]] = fir.convert %[[I]] : (!fir.ref<i32>) -> !fir.ref<none>
27 ! CHECK: fir.call @_QPassumed(%[[CONV]]) {{.*}}: (!fir.ref<none>) -> ()
29 subroutine call_assumed_r()
30 integer, target
:: i(10)
34 ! CHECK-LABEL: func.func @_QMassumed_type_testPcall_assumed_r() {
35 ! CHECK: %[[I:.*]] = fir.alloca !fir.array<10xi32> {bindc_name = "i", fir.target, uniq_name = "_QMassumed_type_testFcall_assumed_rEi"}
36 ! CHECK: %[[CONV:.*]] = fir.convert %[[I]] : (!fir.ref<!fir.array<10xi32>>) -> !fir.ref<!fir.array<?xnone>>
37 ! CHECK: fir.call @_QPassumed_r(%[[CONV]]) {{.*}} : (!fir.ref<!fir.array<?xnone>>) -> ()
39 subroutine assumed_type_optional_to_intrinsic(a
)
40 type(*), optional
:: a(:)
41 if (present(a
)) print*, 'present'
44 ! CHECK-LABEL: func.func @_QMassumed_type_testPassumed_type_optional_to_intrinsic(
45 ! CHECK-SAME: %[[ARG0:.*]]: !fir.box<!fir.array<?xnone>> {fir.bindc_name = "a", fir.optional}) {
46 ! CHECK: %{{.*}} = fir.is_present %[[ARG0]] : (!fir.box<!fir.array<?xnone>>) -> i1
48 subroutine assumed_type_lbound(a
)
49 type(*), optional
:: a(:,:)
50 print*,lbound(a
,dim
=1)
53 ! CHECK-LABEL: func.func @_QMassumed_type_testPassumed_type_lbound(
54 ! CHECK-SAME: %[[ARG0:.*]]: !fir.box<!fir.array<?x?xnone>> {fir.bindc_name = "a", fir.optional}) {
55 ! CHECK: %[[C1:.*]] = arith.constant 1 : i32
56 ! CHECK: %{{.*}} = fir.call @_FortranAioOutputInteger32(%{{.*}}, %[[C1]]) {{.*}} : (!fir.ref<i8>, i32) -> i1