File: derived-type-descriptor.f90

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (55 lines) | stat: -rw-r--r-- 2,343 bytes parent folder | download | duplicates (16)
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
! Test lowering of derived type descriptors builtin data
! RUN: bbc -emit-fir %s -o - | FileCheck %s
! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s

subroutine foo()
  real, save, target :: init_values(10, 10)
  type sometype
    integer :: num = 42
    real, pointer :: values(:, :) => init_values
  end type
  type(sometype), allocatable, save :: x(:)
end subroutine

! CHECK-LABEL: fir.global linkonce_odr @_QFfooE.n.num constant target : !fir.char<1,3> {
! CHECK: %[[res:.*]] = fir.string_lit "num"(3) : !fir.char<1,3>
! CHECK: fir.has_value %[[res]] : !fir.char<1,3>
! CHECK-LABEL: fir.global linkonce_odr @_QFfooE.di.sometype.num constant target : i32
! CHECK-LABEL: fir.global linkonce_odr @_QFfooE.n.values constant target : !fir.char<1,6> {
! CHECK: %[[res:.*]] = fir.string_lit "values"(6) : !fir.char<1,6>
! CHECK: fir.has_value %[[res]] : !fir.char<1,6>
! CHECK-LABEL: fir.global linkonce_odr @_QFfooE.n.sometype constant target : !fir.char<1,8> {
! CHECK: %[[res:.*]] = fir.string_lit "sometype"(8) : !fir.char<1,8>
! CHECK: fir.has_value %[[res]] : !fir.char<1,8>

! CHECK-LABEL: fir.global linkonce_odr @_QFfooE.di.sometype.values constant target : !fir.type<_QFfooT.dp.sometype.values{values:!fir.box<!fir.ptr<!fir.array<?x?xf32>>>}> {
  ! CHECK: fir.address_of(@_QFfooEinit_values)
! CHECK: }

! CHECK-LABEL: fir.global linkonce_odr @_QFfooE.dt.sometype constant target {{.*}} {
  !CHECK: fir.address_of(@_QFfooE.n.sometype)
  !CHECK: fir.address_of(@_QFfooE.c.sometype)
! CHECK:}

! CHECK-LABEL: fir.global linkonce_odr @_QFfooE.c.sometype constant {{.*}} {
  ! CHECK: fir.address_of(@_QFfooE.n.num)
  ! CHECK: fir.address_of(@_QFfooE.di.sometype.num) : !fir.ref<i32>
  ! CHECK: fir.address_of(@_QFfooE.n.values)
  ! CHECK: fir.address_of(@_QFfooE.di.sometype.values)
! CHECK: }

subroutine char_comp_init()
  implicit none  
  type t
     character(8) :: name='Empty'
  end type t
  type(t) :: a
end subroutine

! CHECK-LABEL: fir.global linkonce_odr @_QFchar_comp_initE.di.t.name constant target : !fir.char<1,8> {
! CHECK: %[[res:.*]] = fir.string_lit "Empty   "(8) : !fir.char<1,8>
! CHECK: fir.has_value %[[res]] : !fir.char<1,8>

! CHECK-LABEL: fir.global linkonce_odr @_QFchar_comp_initE.c.t constant target : {{.*}} {
  ! CHECK: fir.address_of(@_QFchar_comp_initE.di.t.name) : !fir.ref<!fir.char<1,8>>
! CHECK: }