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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
            Summary|Fortran 95: Reject namelist |Fortran 2003/2008: Valid
                   |objects of non-constant     |NAMELIST rejected; Fortran
                   |size                        |95: Invalid namelist
                   |                            |objects accepted

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-18 
12:50:52 UTC ---
The check is currently done at match.c's gfc_match_namelist and at resolve.c's
resolve_fl_namelist.

MISSING (valid F2003, invalid F95):
- sym->ts.u.cl->length && !gfc_is_constant_expr (sym->ts.u.cl->length)
- sym->attr.pointer || sym->attr.allocatable

Seemingly in gfc_match_namelist already covered -- and is thus REJECTS-VALID
for Fortran 2003:
- Non-constant arrays
- Allocatable/pointer components*
+ Handling of polymorphic objects*

*Note: this requires defined I/O, cf. quote below.


Example for rejects valid:
  subroutine test1(n)
    integer:: a(n)
    namelist /nml/ a
  end subroutine test1


 * * *

For completeness: F2008 lists additionally the following in "5.6 NAMELIST
statement":

"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 conrm the implied type and type
parameters."


And in "9.6.4.7 Namelist formatting" [...]:

"Every allocatable namelist-group-object in the namelist group shall be
allocated and every namelist-group-object that is a pointer shall be associated
with a target. If a namelist-group-object is polymorphic or has an ultimate
component that is allocatable or a pointer, that object shall be processed by a
defined input/output procedure (9.6.4.8)."

Reply via email to