1 ! Test calls with POINTER dummy arguments on the callee side.
2 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
4 ! CHECK-LABEL: func @_QPchar_assumed(
5 ! CHECK-SAME: %[[arg0:.*]]: !fir.ref<!fir.box<!fir.ptr<!fir.char<1,?>>>>{{.*}}
6 subroutine char_assumed(a
)
8 character(len
=*), pointer :: a
9 ! CHECK: %[[argLoad:.*]] = fir.load %[[arg0]] : !fir.ref<!fir.box<!fir.ptr<!fir.char<1,?>>>>
10 ! CHECK: %[[argLen:.*]] = fir.box_elesize %[[argLoad]] : (!fir.box<!fir.ptr<!fir.char<1,?>>>) -> index
13 ! CHECK: %[[argLenCast:.*]] = fir.convert %[[argLen]] : (index) -> i32
14 ! CHECK: fir.store %[[argLenCast]] to %{{.*}} : !fir.ref<i32>
17 ! CHECK-LABEL: func @_QPchar_assumed_optional(
18 ! CHECK-SAME: %[[arg0:.*]]: !fir.ref<!fir.box<!fir.ptr<!fir.char<1,?>>>>{{.*}}
19 subroutine char_assumed_optional(a
)
21 character(len
=*), pointer, optional
:: a
22 ! CHECK: %[[argPresent:.*]] = fir.is_present %[[arg0]] : (!fir.ref<!fir.box<!fir.ptr<!fir.char<1,?>>>>) -> i1
23 ! CHECK: %[[argLen:.*]] = fir.if %[[argPresent]] -> (index) {
24 ! CHECK: %[[argLoad:.*]] = fir.load %[[arg0]] : !fir.ref<!fir.box<!fir.ptr<!fir.char<1,?>>>>
25 ! CHECK: %[[argLoadLen:.*]] = fir.box_elesize %[[argLoad]] : (!fir.box<!fir.ptr<!fir.char<1,?>>>) -> index
26 ! CHECK: fir.result %[[argLoadLen]] : index
28 ! CHECK: %[[undef:.*]] = fir.undefined index
29 ! CHECK: fir.result %[[undef]] : index
34 ! CHECK: %[[argLenCast:.*]] = fir.convert %[[argLen]] : (index) -> i32
35 ! CHECK: fir.store %[[argLenCast]] to %{{.*}} : !fir.ref<i32>