[Bug libfortran/18982] New: open(status="new") does not generate an error if the file exists

Thomas dot Koenig at online dot de gcc-bugzilla@gcc.gnu.org
Tue Dec 14 13:30:00 GMT 2004


$ cat open.f90
  nout = 10
  open(nout, file="foo.dat", status="new")
  close(nout)
  open(nout, file="foo.dat", status="new",err=100)  ! This should fail
  write(nout,*) "Hello"                     ! and not this.
100 continue
end
$ rm -f foo.dat
$ gfortran open.f90
$ ./a.out
At line 5 of file open.f90
Fortran runtime error: Cannot write to file opened for READ

-- 
           Summary: open(status="new") does not generate an error if the
                    file exists
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Thomas dot Koenig at online dot de
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18982



More information about the Gcc-bugs mailing list