gfortran is giving an error on this program, while g77 is happy with it - [dranta:~/tests/gfortran-D] dir% g77 -o write18 write18.f [dranta:~/tests/gfortran-D] dir% write18 [dranta:~/tests/gfortran-D] dir% gfortran -o write18 write18.f [dranta:~/tests/gfortran-D] dir% write18 At line 9 of file write18.f Fortran runtime error: Invalid argument [dranta:~/tests/gfortran-D] dir% cat write18.f integer data data=-1 open(unit=11,status='scratch',form='unformatted') write(11)data read(11,end= 1000 )data 1000 continue backspace 11 backspace 11 read(11,end= 1001 )data 1001 continue if(data.ne.-1)then write(6,*)data call abort endif close(11) end [dranta:~/tests/gfortran-D] dir% gfortran --v Using built-in specs. Target: powerpc-apple-darwin8.3.0 Configured with: ../gcc/configure --prefix=/Users/dir/gfortran --enable-languages=c,f95 Thread model: posix gcc version 4.2.0 20051229 (experimental) [dranta:~/tests/gfortran-D] dir%
Confirmed.
This test case does not fail with 4.0.3. That makes this a regression.
I have started looking into this one.
Submitting patch for review.
Subject: Bug 25598 Author: jvdelisle Date: Fri Jan 6 01:39:34 2006 New Revision: 109405 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109405 Log: 2006-01-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/25598 * io/file_pos.c (unformatted_backspace): Assure the new file position to seek is not less than zero. (st_backspace): Set unit bytes_left to zero. * io/transfer.c (next_record_r): Fix line lengths, no functional change. Modified: trunk/libgfortran/ChangeLog trunk/libgfortran/io/file_pos.c trunk/libgfortran/io/transfer.c
Subject: Bug 25598 Author: jvdelisle Date: Fri Jan 6 01:44:31 2006 New Revision: 109406 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109406 Log: 2005-01-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/25598 * gfortran.dg/backspace_3.f: New test. * gfortran.dg/backspace_4.f: New test. Added: trunk/gcc/testsuite/gfortran.dg/backspace_3.f trunk/gcc/testsuite/gfortran.dg/backspace_4.f Modified: trunk/gcc/testsuite/ChangeLog
Subject: Bug 25598 Author: jvdelisle Date: Fri Jan 6 05:21:01 2006 New Revision: 109408 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109408 Log: 2006-01-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/25598 * io/file_pos.c (unformatted_backspace): Assure the new file position to seek is not less than zero. (st_backspace): Set unit bytes_left to zero. * io/transfer.c (next_record_r): Fix line lengths, no functional change. Fix date on ChangeLog Modified: trunk/gcc/fortran/ChangeLog
Subject: Bug 25598 Author: jvdelisle Date: Sun Jan 8 02:16:11 2006 New Revision: 109469 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109469 Log: 2006-01-07 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/25598 * io/file_pos.c (unformatted_backspace): Assure the new file position to seek is not less than zero. (st_backspace): Set unit bytes_left to zero. * io/transfer.c (next_record_r): Fix line lengths, no functional change. Modified: branches/gcc-4_1-branch/libgfortran/ChangeLog branches/gcc-4_1-branch/libgfortran/io/file_pos.c branches/gcc-4_1-branch/libgfortran/io/transfer.c
Subject: Bug 25598 Author: jvdelisle Date: Sun Jan 8 02:17:54 2006 New Revision: 109470 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109470 Log: 2005-01-07 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/25598 * gfortran.dg/backspace_3.f: New test. * gfortran.dg/backspace_4.f: New test. Added: branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/backspace_3.f branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/backspace_4.f Modified: branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
Fixed in 4.1 and 4.2