[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Lower / Intrinsics / trim.f90
blobf242e486c8ab75037bca131f5b3337b999866b13
1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
2 ! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s
4 ! CHECK-LABEL: func @_QPtrim_test(
5 ! CHECK-SAME: %[[arg0:.*]]: !fir.boxchar<1>{{.*}}) {
6 subroutine trim_test(c)
7 character(*) :: c
8 ! CHECK: %[[tmpBox:.*]] = fir.alloca !fir.box<!fir.heap<!fir.char<1,?>>>
9 ! CHECK-DAG: %[[c:.*]]:2 = fir.unboxchar %[[arg0]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
10 ! CHECK-DAG: %[[cBox:.*]] = fir.embox %[[c]]#0 typeparams %[[c]]#1 : (!fir.ref<!fir.char<1,?>>, index) -> !fir.box<!fir.char<1,?>>
11 ! CHECK-DAG: %[[cBoxNone:.*]] = fir.convert %[[cBox]] : (!fir.box<!fir.char<1,?>>) -> !fir.box<none>
12 ! CHECK-DAG: %[[resBox:.*]] = fir.convert %[[tmpBox]] : (!fir.ref<!fir.box<!fir.heap<!fir.char<1,?>>>>) -> !fir.ref<!fir.box<none>>
13 ! CHECK: fir.call @{{.*}}Trim(%[[resBox]], %[[cBoxNone]], {{.*}}) {{.*}}: (!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.ref<i8>, i32) -> none
14 ! CHECK-DAG: %[[tmpAddr:.*]] = fir.box_addr
15 ! CHECK-DAG: fir.box_elesize
16 ! CHECK: fir.call @{{.*}}bar_trim_test
17 call bar_trim_test(trim(c))
18 ! CHECK: fir.freemem %[[tmpAddr]] : !fir.heap<!fir.char<1,?>>
19 return
20 end subroutine