This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47339] New: Fortran 95: Reject namelist objects of non-constant size
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 18 Jan 2011 09:50:39 +0000
- Subject: [Bug fortran/47339] New: Fortran 95: Reject namelist objects of non-constant size
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: burnus@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.