From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26106 invoked by alias); 1 Apr 2007 03:46:06 -0000 Received: (qmail 25942 invoked by uid 48); 1 Apr 2007 03:45:54 -0000 Date: Sun, 01 Apr 2007 03:46:00 -0000 Message-ID: <20070401034554.25941.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libfortran/31409] [4.1 4.2 regression] Reading after ERROR_SHORT_RECORD In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jvdelisle 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: 2007-04/txt/msg00003.txt.bz2 ------- Comment #3 from jvdelisle at gcc dot gnu dot org 2007-04-01 04:45 ------- I believe gfortran 4.3 is correctly handling this test case. There should be two error messages from trying to read the larger B(4) array from a record that contains a smaller A(2) array, thus reading past end of record in those cases. After the errors, gfortran positions correctly to read the next available record. Gfortran behavior matches ifort. It would be interesting to see what other compilers do. I have not checked gfortran 4.2 yet. However, reviewing the code in transfer.c (read_block_direct) I suspect 4.2 is OK. The code we have now in 4.2 and 4.3 is as follows: /* Let's make sure the file position is correctly set for the next read statement. */ next_record_r_unf (dtp, 0); us_read (dtp, 0); generate_error (&dtp->common, ERROR_SHORT_RECORD, NULL); return; This is very similar to Georgy's patch with a call to next_record to correctly position the file for the following record, Clearly, from Georgy's data, 4.1.2 is failing I think the fix we have now in 4.2 and 4.3 (or similar) should be backported to the 4.1 branch. -- jvdelisle at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[4.1 4.2 4.3 regression] |[4.1 4.2 regression] |Reading after |Reading after |ERROR_SHORT_RECORD |ERROR_SHORT_RECORD http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31409