This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [patch, fortran] PR30481 Accepts namelist-group object with assumed character length
- From: Tobias Burnus <burnus at net-b dot de>
- To: Brooks Moses <brooks dot moses at codesourcery dot com>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Tue, 23 Jan 2007 09:49:38 +0100
- Subject: Re: [patch, fortran] PR30481 Accepts namelist-group object with assumed character length
- References: <45B578BF.2090406@verizon.net> <45B5C41D.8060601@codesourcery.com>
Hi,
Brooks Moses wrote:
> I seem to recall a discussion of this on comp.lang.fortran recently,
> where it was mentioned that this restriction was a F95 thing that was
> relaxed in F2003. Unfortunately, I can't seem to find the comment
> again, but it looks to me like the language in the standard does relax
> the restriction.
The thread which lead to the bug report is at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/75b797b2d4257f74
but there I cannot find anything about a relaxation in Fortran 2003.
The standard text is:
Fortran 95:
"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."
And Fortran 2003:
"5.4 NAMELIST statement"
"C574 (R553) A namelist-group-object shall not be an assumed-size array."
"A namelist group object shall either be accessed by use or host association or
shall have its type, type parameters, and shape specified by previous
specification statements or the procedure heading in the same scoping unit or
by the implicit typing rules in effect for the scoping unit. If a namelist
group object is typed by the implicit typing rules, its appearance in any
subsequent type declaration statement shall confirm the implied type and type
parameters."
I have actually some problems in fully understanding the Fortran 2003 text.
Note that Richard Main wrote in that thread:
"I'll also note that I don't see any big reason why the standard
couldn't be extended to allow this in the future. When Namelist was
added to the standard (in f90), it was done in a pretty conservative and
minimalist fashion in several regards. In my personal judgement, this
particular restriction was probably overkill in that I wouldn't expect
it to be hard to implement in
most compilers."
Given that he knows the standard pretty well, it indicates that it might
indeed be still not allowed in F2003.
> If that's true, I'd suggest that this should be a -std=f95 thing, not
an absolute error.
If it is true, then yes. Otherwise: Explicit error or legacy?
Tobias