brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 44ce41d Raw
59 lines · plain
1! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s2 3module assumed_type_test4 5  interface6    subroutine assumed(a)7      type(*), intent(in), target :: a8    end subroutine9  end interface10 11  interface12    subroutine assumed_r(a)13      type(*), intent(in), target :: a(*)14    end subroutine15  end interface16 17contains18 19  subroutine call_assumed()20    integer, target :: i21    call assumed(i)22  end subroutine23 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>) -> ()28 29  subroutine call_assumed_r()30    integer, target :: i(10)31    call assumed_r(i)32  end subroutine33 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>>) -> ()38 39  subroutine assumed_type_optional_to_intrinsic(a)40    type(*), optional :: a(:)41    if (present(a)) print*, 'present'42  end subroutine43 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>>) -> i147 48  subroutine assumed_type_lbound(a)49    type(*), optional :: a(:,:)50    print*,lbound(a,dim=1)51  end subroutine52 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 : i3256! CHECK: %{{.*}} = fir.call @_FortranAioOutputInteger32(%{{.*}}, %[[C1]]) {{.*}} : (!fir.ref<i8>, i32) -> i157 58end module59