From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12772 invoked by alias); 5 Mar 2010 09:08:04 -0000 Received: (qmail 12675 invoked by uid 48); 5 Mar 2010 09:07:50 -0000 Date: Fri, 05 Mar 2010 09:08:00 -0000 Message-ID: <20100305090750.12674.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/43265] [4.3/4.4/4.5 Regression] No EOF condition if reading with '(x)' from an empty file In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" 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: 2010-03/txt/msg00446.txt.bz2 ------- Comment #1 from burnus at gcc dot gnu dot org 2010-03-05 09:07 ------- Jerry, can you have a look? With gfortran 4.1 and 4.2, g95, ifort, openf95, and NAG f95 the program immediately returns with "ended". However, in gfortran 4.3, 4.4, and 4.5 it simply loops through without hitting "end=". Using * instead of (x) as fmt, I get immediately an "End of File" - as expected. (In my case, there was no file and OPEN created an empty one.) In a way it is not surprising. In io/read.c: read_x (st_parameter_dt * dtp, int n) [...] read_sf (dtp, &n, 1); and then in io/transfer.c: read_sf (st_parameter_dt *dtp, int * length, int no_error) [...] /* If we hit EOF previously with the no_error flag set (i.e. X, T, TR edit descriptors), and we now try to read again, this time without setting no_error. */ if (!no_error && dtp->u.p.at_eof) { *length = 0; hit_eof (dtp); return NULL; } [...] base = p = fbuf_read (dtp->u.p.current_unit, length); if (base == NULL) return NULL; -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jvdelisle at gcc dot gnu dot | |org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 GCC host triplet|i686-pc-linux-gnu | Keywords| |wrong-code Known to fail| |4.3.4 4.4.4 4.5.0 Known to work| |4.1.2 4.2.1 Last reconfirmed|0000-00-00 00:00:00 |2010-03-05 09:07:49 date| | Summary|Read no longer jumps on end |[4.3/4.4/4.5 Regression] No | |EOF condition if reading | |with '(x)' from an empty | |file Target Milestone|--- |4.4.4 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43265