------- 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

Reply via email to