File: io-derived-type-2.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 (70 lines) | stat: -rw-r--r-- 2,683 bytes parent folder | download | duplicates (9)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
! Check that InputDerivedType/OutputDeriverType APIs are used
! for io of derived types.
! RUN: bbc -emit-fir -o - %s | FileCheck %s

module p
  type :: person
     type(person), pointer :: next => null()
  end type person
  type :: club
     class(person), allocatable :: membership(:)
  end type club
contains
  subroutine pwf (dtv,unit,iotype,vlist,iostat,iomsg)
    class(person), intent(in) :: dtv
    integer, intent(in) :: unit
    character (len=*), intent(in) :: iotype
    integer, intent(in) :: vlist(:)
    integer, intent(out) :: iostat
    character (len=*), intent(inout) :: iomsg
    print *, 'write'
  end subroutine pwf
  subroutine prf (dtv,unit,iotype,vlist,iostat,iomsg)
    class(person), intent(inout) :: dtv
    integer, intent(in) :: unit
    character (len=*), intent(in) :: iotype
    integer, intent(in) :: vlist(:)
    integer, intent(out) :: iostat
    character (len=*), intent(inout) :: iomsg
  end subroutine prf
  subroutine test1(dtv)
    interface read(formatted)
       module procedure prf
    end interface read(formatted)
    class(person), intent(inout) :: dtv
    read(7, fmt='(DT)') dtv%next
  end subroutine test1
! CHECK-LABEL:   func.func @_QMpPtest1(
! CHECK:           %{{.*}} = fir.call @_FortranAioInputDerivedType(%{{.*}}, %{{.*}}, %{{.*}}) fastmath<contract> : (!fir.ref<i8>, !fir.box<none>, !fir.ref<none>) -> i1

  subroutine test2(social_club)
    interface read(formatted)
       module procedure prf
    end interface read(formatted)
    class(club) :: social_club
    read(7, fmt='(DT)') social_club%membership(0)
  end subroutine test2
! CHECK-LABEL:   func.func @_QMpPtest2(
! CHECK:           %{{.*}} = fir.call @_FortranAioInputDerivedType(%{{.*}}, %{{.*}}, %{{.*}}) fastmath<contract> : (!fir.ref<i8>, !fir.box<none>, !fir.ref<none>) -> i1

  subroutine test3(dtv)
    interface write(formatted)
       module procedure pwf
    end interface write(formatted)
    class(person), intent(inout) :: dtv
    write(7, fmt='(DT)') dtv%next
  end subroutine test3
! CHECK-LABEL:   func.func @_QMpPtest3(
! CHECK:           %{{.*}} = fir.call @_FortranAioOutputDerivedType(%{{.*}}, %{{.*}}, %{{.*}}) fastmath<contract> : (!fir.ref<i8>, !fir.box<none>, !fir.ref<none>) -> i1

  subroutine test4(social_club)
    interface write(formatted)
       module procedure pwf
    end interface write(formatted)
    class(club) :: social_club
    write(7, fmt='(DT)') social_club%membership(0)
  end subroutine test4
! CHECK-LABEL:   func.func @_QMpPtest4(
! CHECK:           %{{.*}} = fir.call @_FortranAioOutputDerivedType(%{{.*}}, %{{.*}}, %{{.*}}) fastmath<contract> : (!fir.ref<i8>, !fir.box<none>, !fir.ref<none>) -> i1
end module p