| 1 |
! Test lowering of derived type with kind parameters |
| 2 |
! RUN: bbc -emit-fir %s -o - | FileCheck %s |
| 3 |
|
| 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 |
| 10 |
|
| 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 |
| 16 |
|
| 17 |
type t3(k) |
| 18 |
integer, kind :: k |
| 19 |
type(t3(k)), pointer :: at3 |
| 20 |
end type |
| 21 |
|
| 22 |
type t4(k) |
| 23 |
integer, kind :: k |
| 24 |
real(-k) :: i |
| 25 |
end type |
| 26 |
|
| 27 |
contains |
| 28 |
|
| 29 |
! ----------------------------------------------------------------------------- |
| 30 |
! Test mangling of derived type with kind parameters |
| 31 |
! ----------------------------------------------------------------------------- |
| 32 |
|
| 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 |
| 38 |
|
| 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 |
| 44 |
|
| 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 |
| 50 |
|
| 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 |