Bug 25036 - Reopening a file with STATUS='UNKNOWN' should work
Summary: Reopening a file with STATUS='UNKNOWN' should work
Status: RESOLVED DUPLICATE of bug 24945
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Janne Blomqvist
URL:
Keywords:
Depends on:
Blocks: 19292
  Show dependency treegraph
 
Reported: 2005-11-25 19:04 UTC by Janne Blomqvist
Modified: 2005-11-26 08:52 UTC (History)
4 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2005-11-25 20:40:27


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Janne Blomqvist 2005-11-25 19:04:49 UTC
The program

       program test
       integer :: fh = 71
       open(fh, file="f", form='unformatted', status='unknown')
!      close(fh)
       open(fh, file="f", form='unformatted', status='unknown')
       end program

fails with

At line 5 of file file-status-old.f90
Fortran runtime error: OPEN statement must have a STATUS of OLD

The F2003 standard says that if status='unknown', which is the same as if no status specifier is present, then the status is processor dependent. So technically this is not a standard conformance bug, but it's still a problem for some real codes, and it doesn't cost us anything to allow it.

Thanks to Bernhard Fischer for bringing up this problem.
Comment 1 Janne Blomqvist 2005-11-25 19:13:56 UTC
Also, g77 (and pathscale and ifort) support reopening files with status='unknown'.
Comment 2 Janne Blomqvist 2005-11-25 20:39:05 UTC
Patch here: http://gcc.gnu.org/ml/fortran/2005-11/msg00677.html
Comment 3 Andrew Pinski 2005-11-25 20:40:27 UTC
Confirmed.
Comment 4 Janne Blomqvist 2005-11-26 08:52:04 UTC
This seems to be a duplicate of PR 24945. Sorry.

*** This bug has been marked as a duplicate of 24945 ***