1 ! Check that InputDerivedType/OutputDeriverType APIs are used
2 ! for io of derived types.
3 ! RUN: bbc -emit-fir -o - %s | FileCheck %s
7 type(person
), pointer :: next
=> null()
10 class(person
), allocatable
:: membership(:)
13 subroutine pwf (dtv
,unit
,iotype
,vlist
,iostat
,iomsg
)
14 class(person
), intent(in
) :: dtv
15 integer, intent(in
) :: unit
16 character (len
=*), intent(in
) :: iotype
17 integer, intent(in
) :: vlist(:)
18 integer, intent(out
) :: iostat
19 character (len
=*), intent(inout
) :: iomsg
22 subroutine prf (dtv
,unit
,iotype
,vlist
,iostat
,iomsg
)
23 class(person
), intent(inout
) :: dtv
24 integer, intent(in
) :: unit
25 character (len
=*), intent(in
) :: iotype
26 integer, intent(in
) :: vlist(:)
27 integer, intent(out
) :: iostat
28 character (len
=*), intent(inout
) :: iomsg
31 interface read(formatted
)
33 end interface read(formatted
)
34 class(person
), intent(inout
) :: dtv
35 read(7, fmt
='(DT)') dtv
%next
37 ! CHECK-LABEL: func.func @_QMpPtest1(
38 ! CHECK: %{{.*}} = fir.call @_FortranAioInputDerivedType(%{{.*}}, %{{.*}}, %{{.*}}) fastmath<contract> : (!fir.ref<i8>, !fir.box<none>, !fir.ref<none>) -> i1
40 subroutine test2(social_club
)
41 interface read(formatted
)
43 end interface read(formatted
)
44 class(club
) :: social_club
45 read(7, fmt
='(DT)') social_club
%membership(0)
47 ! CHECK-LABEL: func.func @_QMpPtest2(
48 ! CHECK: %{{.*}} = fir.call @_FortranAioInputDerivedType(%{{.*}}, %{{.*}}, %{{.*}}) fastmath<contract> : (!fir.ref<i8>, !fir.box<none>, !fir.ref<none>) -> i1
51 interface write(formatted
)
53 end interface write(formatted
)
54 class(person
), intent(inout
) :: dtv
55 write(7, fmt
='(DT)') dtv
%next
57 ! CHECK-LABEL: func.func @_QMpPtest3(
58 ! CHECK: %{{.*}} = fir.call @_FortranAioOutputDerivedType(%{{.*}}, %{{.*}}, %{{.*}}) fastmath<contract> : (!fir.ref<i8>, !fir.box<none>, !fir.ref<none>) -> i1
60 subroutine test4(social_club
)
61 interface write(formatted
)
63 end interface write(formatted
)
64 class(club
) :: social_club
65 write(7, fmt
='(DT)') social_club
%membership(0)
67 ! CHECK-LABEL: func.func @_QMpPtest4(
68 ! CHECK: %{{.*}} = fir.call @_FortranAioOutputDerivedType(%{{.*}}, %{{.*}}, %{{.*}}) fastmath<contract> : (!fir.ref<i8>, !fir.box<none>, !fir.ref<none>) -> i1