File: derived-types-kind-params.f90

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (56 lines) | stat: -rw-r--r-- 1,459 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
! Test lowering of derived type with kind parameters
! RUN: bbc -emit-fir %s -o - | FileCheck %s

module m
  type t(k1, k2)
    integer(4), kind :: k1 = 7
    integer(8), kind :: k2
    character(k1) :: c(k2)
  end type

  type t2(k1, k2)
    integer(4), kind :: k1
    integer(8), kind :: k2
    type(t(k1+3, k2+4)) :: at
  end type

  type t3(k)
    integer, kind :: k
    type(t3(k)), pointer :: at3
  end type

  type t4(k)
    integer, kind :: k
    real(-k) :: i
  end type

contains

! -----------------------------------------------------------------------------
!            Test mangling of derived type with kind parameters
! -----------------------------------------------------------------------------

  ! CHECK-LABEL: func @_QMmPfoo
  ! CHECK-SAME: !fir.ref<!fir.type<_QMmTtK7K12{c:!fir.array<12x!fir.char<1,7>>
  subroutine foo(at)
    type(t(k2=12)) :: at
  end subroutine

  ! CHECK-LABEL: func @_QMmPfoo2
  ! CHECK-SAME: !fir.ref<!fir.type<_QMmTt2K12K13{at:!fir.type<_QMmTtK15K17{c:!fir.array<17x!fir.char<1,15>>}>}>>
  subroutine foo2(at2)
    type(t2(12, 13)) :: at2
  end subroutine

  ! CHECK-LABEL: func @_QMmPfoo3
  ! CHECK-SAME: !fir.ref<!fir.type<_QMmTt3K7{at3:!fir.box<!fir.ptr<!fir.type<_QMmTt3K7>>>}>>
  subroutine foo3(at3)
    type(t3(7)) :: at3
  end subroutine

  ! CHECK-LABEL: func @_QMmPfoo4
  ! CHECK-SAME: !fir.ref<!fir.type<_QMmTt4KN4{i:f32}>>
  subroutine foo4(at4)
    type(t4(-4)) :: at4
  end subroutine
end module