This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

g77: Namelist entry as dummy argument: permitted by the Standard.


Hi Craig,

As I helped write up the interface between the Fortran Frontend and
libf2c on the handling of namelists, this could very wel be my fault:

      subroutine a(i)
      namelist /nam/ i
      read(*,nml=nam)
      end

evokes (gcc-2.95 prerelease):

$ /usr/rel/bin/g77 nam.f
nam.f: In subroutine `a':
nam.f:1: 
         subroutine a(i)
                      1
nam.f:2: (continued):
         namelist /nam/ i
                        2
Invalid declaration of or reference to symbol `i' at (2) [initially seen
at (1)]

However, this is not prohibited by the Standard:

5.5 Namelist statement:

...

Constraint:

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

...

[ the wording is that of the upcoming F2K standard, but the crux remains
  the same: scalar dummy arguments are not excluded ]

-- 
Toon Moene (toon@moene.indiv.nluug.nl)
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Phone: +31 346 214290; Fax: +31 346 214286
GNU Fortran: http://world.std.com/~burley/g77.html


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]