Debian Codegraph @

gcc/testsuite/gfortran.dg/dtio_37.f90

raw
1 ! { dg-do run }
2 ! { dg-additional-options "-O2" }
3 !
4 ! PR fortran/125059 - derived type IO and automatic deallocation
5 ! PR fortran/111952
6
7 module m
8 type t
9 integer :: i = 42
10 contains
11 procedure :: w
12 generic :: write(formatted) => w
13 end type t
14 contains
15 subroutine w(dtv,unit,iotype,v_list,iostat,iomsg)
16 class(t), intent(in) :: dtv
17 integer, intent(in) :: unit
18 character(len=*),intent(in) :: iotype
19 integer, intent(in) :: v_list(:)
20 integer, intent(out) :: iostat
21 character(len=*),intent(inout) :: iomsg
22 write(unit,*,iostat=iostat,iomsg=iomsg) dtv%i
23 end subroutine w
24 end
25
26 program p
27 use m
28 call f()
29 call f()
30 contains
31 subroutine f()
32 type(t), allocatable :: a(:)
33 allocate (a(1))
34 print *, a(1)
35 end subroutine f
36 end