From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7557 invoked by alias); 6 Jun 2011 06:16:02 -0000 Received: (qmail 7549 invoked by uid 22791); 6 Jun 2011 06:16:01 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 06 Jun 2011 06:15:48 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/49296] New: [4.6/4.7 Regression] Wrong I/O END OF FILE X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 06 Jun 2011 06:16:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg00360.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49296 Summary: [4.6/4.7 Regression] Wrong I/O END OF FILE Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: burnus@gcc.gnu.org CC: jvdelisle@gcc.gnu.org Reported by Reinhold Bader (LRZ). The following program prints with gfortran 4.5 (and ifort 11, NAG 5.1, g95, pathf95): OK With gfortran 4.6/4.7, it prints: At line 11 of file read_listdir_01_pos.f90 (unit = 20, file = 'read.dat') Fortran runtime error: End of file --------- C part of the test program ----------- #include void genfil() { FILE *fp; fp = fopen("read.dat", "w+"); fprintf(fp, "abcd efgh"); fclose(fp); } --------- Fortran part of the test program ----------- program read_listdir_01_pos implicit none integer, parameter :: strmx = 255 character(len=strmx) :: s1, s2 interface subroutine genfil() bind(c) end subroutine genfil end interface call genfil() open(unit=20, file='read.dat', form='FORMATTED', action='READ', status='OLD') read(20, fmt=*) s1, s2 if (trim(s1) == "abcd" .and. trim(s2) == "efgh") then write(*, *) 'OK' else write(*, *) 'FAIL' end if close(20) end program read_listdir_01_pos