1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
3 ! CHECK-LABEL: func @_QPchar_return_callee(
4 ! CHECK-SAME: %{{.*}}: !fir.ref<!fir.char<1,10>>{{.*}}, %{{.*}}: index{{.*}}, %{{.*}}: !fir.ref<i32>{{.*}}) -> !fir.boxchar<1> {
5 function char_return_callee(i
)
6 character(10) :: char_return_callee
10 ! CHECK-LABEL: @_QPtest_char_return_caller()
11 subroutine test_char_return_caller
12 character(10) :: char_return_caller
13 ! CHECK: fir.call @_QPchar_return_caller({{.*}}) {{.*}}: (!fir.ref<!fir.char<1,10>>, index, !fir.ref<i32>) -> !fir.boxchar<1>
14 print *, char_return_caller(5)
17 ! CHECK-LABEL: func @_QPtest_passing_char_array()
18 subroutine test_passing_char_array
19 character(len
=3) :: x(4)
20 call sub_taking_a_char_array(x
)
21 ! CHECK-DAG: %[[xarray:.*]] = fir.alloca !fir.array<4x!fir.char<1,3>>
22 ! CHECK-DAG: %[[c3:.*]] = arith.constant 3 : index
23 ! CHECK-DAG: %[[xbuff:.*]] = fir.convert %[[xarray]] : (!fir.ref<!fir.array<4x!fir.char<1,3>>>) -> !fir.ref<!fir.char<1,?>>
24 ! CHECK: %[[boxchar:.*]] = fir.emboxchar %[[xbuff]], %[[c3]] : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
25 ! CHECK: fir.call @_QPsub_taking_a_char_array(%[[boxchar]]) {{.*}}: (!fir.boxchar<1>) -> ()
28 ! TODO more implicit interface cases with/without explicit interface