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

           Summary: Fortran 95: Reject namelist objects of non-constant
                    size
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org


Fortran 95 contains at "5.4 NAMELIST statement":

"Constraint: A namelist-group-object shall not be an array dummy argument with
a nonconstant bound, a variable with nonconstant character length, an automatic
object, a pointer, a variable of a type that has an ultimate component that is
a pointer, or an allocatable array."

However, the following programs is not rejected using "gfortran -std=f95
-pedantic":

subroutine test1(n)
  character(len=n) :: str
  namelist /nml/ str
end subroutine test1

Expected: An error as printed by g95:
  Error: Variable 'str' at (1) cannot have a variable length and be in a
NAMELIST
or as with NAG:
  Error: Namelist-group-object STR is an automatic object
or as with PathScale:
  "STR" is a namelist-group-object, therefore it must not be typed as variable
length character.


Note: In Fortran 2003 (and 2008) the restriction has been lifted and only the
following is left, which is properly diagnosed

C574 (R553) A namelist-group-object shall not be an assumed-size array.

Reply via email to