Debian Codegraph @

gcc/testsuite/gfortran.dg/pr105361.f90

raw
1 ! { dg-do run }
2
3 module x
4 implicit none
5 type foo
6 real(4) :: r
7 end type foo
8 interface read(formatted)
9 module procedure read_formatted
10 end interface read(formatted)
11 contains
12 subroutine read_formatted (dtv, unit, iotype, vlist, iostat, iomsg)
13 class (foo), intent(inout) :: dtv
14 integer, intent(in) :: unit
15 character (len=*), intent(in) :: iotype
16 integer, intent(in) :: vlist(:)
17 integer, intent(out) :: iostat
18 character (len=*), intent(inout) :: iomsg
19 read (unit,*,iostat=iostat,iomsg=iomsg) dtv%r
20 !print *,dtv%r
21 end subroutine read_formatted
22 end module x
23
24 program main
25 use x
26 implicit none
27 type(foo) :: a, b
28 real(4) :: c, d
29 c = 0.0_4
30 d = 0.0_4
31 open(10, access="stream")
32 write(10) "1 2" // NEW_LINE('A')
33 close(10)
34 open(10)
35 read(10,*) c, d
36 if ((abs(c - 1.0_4) .gt. 0.001_4) .or. (abs(d - 2.0_4) .gt. 0.001_4)) stop 1
37 rewind(10)
38 !print *, c,d
39 a%r = 0.0_4
40 b%r = 0.0_4
41 read (10,*) a, b
42 close(10, status="delete")
43 if ((abs(a%r - 1.0_4) .gt. 0.001_4) .or. (abs(b%r - 2.0_4) .gt. 0.001_4)) stop 2
44 !print *, a,b
45 end program main