User account creation filtered due to spam.
which also contains a patch.
Strictly speaking, this isn't a wrong-code because
the standard doesn't impose any requirements after
an error condition. However, we do want to fix this.
The patch does not appear to fix this on 4.3
Created attachment 13313 [details]
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);
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.
(In reply to comment #3)
> Gfortran behavior matches ifort. It would be interesting to see what other
> compilers do.
Sun does the same as gfortran and Intel.
> I have not checked gfortran 4.2 yet. However, reviewing the code in transfer.c
> (read_block_direct) I suspect 4.2 is OK.
I tested gfortran-4.2 and it has the same behavior as gfortran-mainline. 4.1.2 gives different results, however. I'm adding the outputs of different version as an attached tar file.
> I think the fix we have now in 4.2 and 4.3 (or similar) should be backported to
> the 4.1 branch.
Keeping this open.
Subject: Bug 31409
Date: Fri May 11 05:40:37 2007
New Revision: 124612
2007-05-10 Jerry DeLisle <firstname.lastname@example.org>
* io/transfer.c (read_block_direct): Backport from 4.3 trunk.
Fixed on 4.1. Not a bug on 4.2 or 4.3