https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83057

            Bug ID: 83057
           Summary: OPEN(3f) without a filename and without
                    STATUS='SCRATCH' does not produce a warning as being
                    an extension on unassigned files
           Product: gcc
           Version: 6.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: urbanjost at comcast dot net
  Target Milestone: ---

The standard states if a unconnected file is opened with a unit but
   not with a  filename that STATUS='SCRATCH' must be supplied. If so,
   the two OPEN(3f) statements below are not standard, but no warning
   is produced. Instead, files fort.20 and fort.-10 are created. The
   program creates the files if they do not exist, and produces no errors
   if they do exist.

   I know many compilers (at least in the past) that create files with
   a default name when a unit without a FILE= specifier is used such as
   below, but it appears that is non-standard.

   So should the OPEN(3f) statements below at least produce a warning
   about being non-standard? I am using GNU Fortran (GCC) 6.4.0:

      gfortran -std=f2008 -Wall xxx.F90   

   Perhaps something like

      'Warning: GNU Fortran extension: OPEN(3f) of an unconnected file without
a filename requires STATUS='SCRATCH' be specified'

! If the NEWUNIT= specifier appears in an OPEN statement, either the
! FILE= specifier shall appear, or the STATUS= specifier shall appear
! with a value of SCRATCH. The unit identified by a NEWUNIT value shall
! not be preconnected.
!
! If the filename is omitted and the unit is not connected to a file,
! the STATUS= specifier shall be specified with a value of SCRATCH;
! in this case, the connection is made to a processor-dependent file.

open(20)
open(newunit=lun)
end

Reply via email to