Bug 20749

Summary: gfortran - error opening direct access file
Product: gcc Reporter: Dale Ranta <dir>
Component: libfortranAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: gcc-bugs
Priority: P2    
Version: 4.0.0   
Target Milestone: ---   
Host: powerpc-apple-darwin7.8.0 Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2005-04-04 19:00:07

Description Dale Ranta 2005-04-04 17:56:15 UTC
Using a fresh build of gfortran from the cvs archive (old versions of gfortran
hit the now fixed - Internal Error: Recursive library error) I get an error
trying to open a direct access file  (g77 and Absoft f77 are happy with it and
gfortran works ok if status='SCRATCH' is used instead of the variable) -

[dranta:~/tests/gfortran] dir% g77 -o direct direct.f
[dranta:~/tests/gfortran] dir% direct
[dranta:~/tests/gfortran] dir% gfortran -o direct direct.f
[dranta:~/tests/gfortran] dir% direct
 ERROR SCRATCH SCRATCH 
STOP 0
[dranta:~/tests/gfortran] dir% cat direct.f
      program main
      CALL OPENF(11,642,'SCRATCH')           
      stop
      end 
      SUBROUTINE OPENF (NT,NRECL,STAT)
      CHARACTER*8 STAT*(*),STATUS
 
      STATUS=STAT
        OPEN(UNIT=NT,STATUS=STATUS,ACCESS='DIRECT',
     $     FORM='UNFORMATTED',RECL=NRECL,ERR=999)

      RETURN
 
  999 Write(*,*)'ERROR ',STAT,' ',STATUS
      RETURN
      END
Comment 1 Andrew Pinski 2005-04-04 19:00:07 UTC
Confirmed.
Comment 2 Thomas Koenig 2005-04-05 06:40:33 UTC
This is the same bug as the first half of 20163, which
is fixed with

http://gcc.gnu.org/ml/gcc-patches/2005-02/msg01694.html

Thomas
Comment 3 Francois-Xavier Coudert 2005-04-12 08:50:51 UTC
Indeed. This is now fixed on mainline. Resolving it as duplicate of PR20163.

$ gfortran -v              
Using built-in specs.
Target: i386-linux
Configured with: ../gcc/configure --prefix=/tmp/gfortran-20050412/irun
--enable-languages=c,f95 --host=i386-linux
Thread model: posix
gcc version 4.1.0 20050412 (experimental)
$ gfortran direct.f && ./a.out
STOP 0


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