[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Lower / derived-types-kind-params.f90
blob54030b910e25182991dad7b097a18b3812e0ad0b
1 ! Test lowering of derived type with kind parameters
2 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
4 module m
5 type t(k1, k2)
6 integer(4), kind :: k1 = 7
7 integer(8), kind :: k2
8 character(k1) :: c(k2)
9 end type
11 type t2(k1, k2)
12 integer(4), kind :: k1
13 integer(8), kind :: k2
14 type(t(k1+3, k2+4)) :: at
15 end type
17 type t3(k)
18 integer, kind :: k
19 type(t3(k)), pointer :: at3
20 end type
22 type t4(k)
23 integer, kind :: k
24 real(-k) :: i
25 end type
27 contains
29 ! -----------------------------------------------------------------------------
30 ! Test mangling of derived type with kind parameters
31 ! -----------------------------------------------------------------------------
33 ! CHECK-LABEL: func @_QMmPfoo
34 ! CHECK-SAME: !fir.ref<!fir.type<_QMmTtK7K12{c:!fir.array<12x!fir.char<1,7>>
35 subroutine foo(at)
36 type(t(k2=12)) :: at
37 end subroutine
39 ! CHECK-LABEL: func @_QMmPfoo2
40 ! CHECK-SAME: !fir.ref<!fir.type<_QMmTt2K12K13{at:!fir.type<_QMmTtK15K17{c:!fir.array<17x!fir.char<1,15>>}>}>>
41 subroutine foo2(at2)
42 type(t2(12, 13)) :: at2
43 end subroutine
45 ! CHECK-LABEL: func @_QMmPfoo3
46 ! CHECK-SAME: !fir.ref<!fir.type<_QMmTt3K7{at3:!fir.box<!fir.ptr<!fir.type<_QMmTt3K7>>>}>>
47 subroutine foo3(at3)
48 type(t3(7)) :: at3
49 end subroutine
51 ! CHECK-LABEL: func @_QMmPfoo4
52 ! CHECK-SAME: !fir.ref<!fir.type<_QMmTt4KN4{i:f32}>>
53 subroutine foo4(at4)
54 type(t4(-4)) :: at4
55 end subroutine
56 end module