[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Fir / achar.f90
blob73fd5a3daa30e5f1358b99a7b3de7ecffa9203f9
1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
3 ! Tests ACHAR lowering (converting an INTEGER to a CHARACTER (singleton, LEN=1)
4 ! along with conversion of CHARACTER to another KIND.
5 subroutine achar_test1(a)
6 integer, parameter :: ckind = 2
7 integer, intent(in) :: a
8 character(kind=ckind, len=1) :: ch
10 ch = achar(a)
11 call achar_test1_foo(ch)
12 end subroutine achar_test1
14 ! CHECK-LABEL: func @_QPachar_test1(
15 ! CHECK-SAME: %[[arg:.*]]: !fir.ref<i32> {fir.bindc_name = "a"}) {
16 ! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.char<1>
17 ! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.char<2> {bindc_name = "ch", uniq_name = "_QFachar_test1Ech"}
18 ! CHECK: %[[VAL_2:.*]] = fir.load %[[arg]] : !fir.ref<i32>
19 ! CHECK: %[[VAL_5:.*]] = fir.undefined !fir.char<1>
20 ! CHECK: %[[VAL_6:.*]] = fir.insert_value %[[VAL_5]], %{{.*}}, [0 : index] : (!fir.char<1>, i8) -> !fir.char<1>
21 ! CHECK: fir.store %[[VAL_6]] to %[[VAL_0]] : !fir.ref<!fir.char<1>>
22 ! CHECK: %[[VAL_7:.*]] = fir.alloca !fir.char<2,?>(%{{.*}} : index)
23 ! CHECK: fir.char_convert %[[VAL_0]] for %{{.*}} to %[[VAL_7]] : !fir.ref<!fir.char<1>>, index, !fir.ref<!fir.char<2,?>>
24 ! CHECK: fir.call @_QPachar_test1_foo(%{{.*}}) {{.*}}: (!fir.boxchar<2>) -> ()