Bug 25598 - [4.1/4.2 Regression] gfortran - Fortran runtime error: Invalid argument
[4.1/4.2 Regression] gfortran - Fortran runtime error: Invalid argument
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: libfortran
4.2.0
: P5 normal
: 4.1.0
Assigned To: Jerry DeLisle
:
Depends on:
Blocks: 19292
  Show dependency treegraph
 
Reported: 2005-12-29 21:00 UTC by Dale Ranta
Modified: 2006-01-08 02:21 UTC (History)
1 user (show)

See Also:
Host: powerpc-apple-darwin8.3.0
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-01-01 05:36:21


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dale Ranta 2005-12-29 21:00:36 UTC
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%
Comment 1 Jerry DeLisle 2005-12-30 04:39:26 UTC
Confirmed.  
Comment 2 Jerry DeLisle 2005-12-30 06:17:08 UTC
This test case does not fail with 4.0.3.  That makes this a regression.
Comment 3 Jerry DeLisle 2006-01-01 05:36:21 UTC
I have started looking into this one.
Comment 4 Jerry DeLisle 2006-01-03 05:30:17 UTC
Submitting patch for review.
Comment 5 Jerry DeLisle 2006-01-06 01:39:38 UTC
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

Comment 6 Jerry DeLisle 2006-01-06 01:44:33 UTC
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

Comment 7 Jerry DeLisle 2006-01-06 05:21:07 UTC
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

Comment 8 Jerry DeLisle 2006-01-08 02:16:17 UTC
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

Comment 9 Jerry DeLisle 2006-01-08 02:17:57 UTC
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

Comment 10 Jerry DeLisle 2006-01-08 02:21:07 UTC
Fixed in 4.1 and 4.2