From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 815C63858C56; Sat, 23 Apr 2022 16:29:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 815C63858C56 From: "tkoenig at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/105361] New: Incorrect end-of-file condition for derived-type I/O Date: Sat, 23 Apr 2022 16:29:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libfortran X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tkoenig at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Apr 2022 16:29:13 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105361 Bug ID: 105361 Summary: Incorrect end-of-file condition for derived-type I/O Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran Assignee: unassigned at gcc dot gnu.org Reporter: tkoenig at gcc dot gnu.org Target Milestone: --- The following test case module x implicit none type foo real :: r end type foo interface read(formatted) module procedure read_formatted end interface read(formatted) contains subroutine read_formatted (dtv, unit, iotype, vlist, iostat, iomsg) class (foo), intent(inout) :: dtv integer, intent(in) :: unit character (len=3D*), intent(in) :: iotype integer, intent(in) :: vlist(:) integer, intent(out) :: iostat character (len=3D*), intent(inout) :: iomsg read (unit,*,iostat=3Diostat,iomsg=3Diomsg) dtv%r print *,dtv%r end subroutine read_formatted end module x program main use x implicit none type(foo) :: a, b read (*,*) a, b print *,a,b end program main yields, when invoked with $ echo "1 2" | ./a.out 1.00000000=20=20=20=20 2.00000000=20=20=20=20 At line 25 of file test.f90 (unit =3D 5, file =3D 'stdin') Fortran runtime error: End of file [...] The end-of-file condition is incorrect. The print statement in read_formatted is there just to show the input is read correctly.=