public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/53544] New: Derived-type components in namelist group declaration produces error
@ 2012-05-31 18:51 townsend at astro dot wisc.edu
  2012-05-31 20:12 ` [Bug fortran/53544] " anlauf at gmx dot de
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: townsend at astro dot wisc.edu @ 2012-05-31 18:51 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53544
           Summary: Derived-type components in namelist group declaration
                    produces error
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: townsend@astro.wisc.edu


Created attachment 27533
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27533
Example program illustrating namelist problem

In the attached example program, the use of derived-type components in the
namelist group declaration causes the following errors:

foo.f90:12.19:

  namelist /bar/ ct%a, ct%b
                   1
Error: Syntax error in NAMELIST statement at (1)
foo.f90:14.17:

  read(*, NML=bar)
                 1
Error: Symbol 'bar' at (1) must be a NAMELIST group name

It is my understanding that the variables in a namelist group declaration must
not be a dummy array with non-constant bound, a variable with non-constant
character length, an automatic object, an allocatable array, a pointer, or have
a component at any depth that is a pointer or is inaccessible. The case in the
example program falls into none of these categories, and therefore should be
accepted by the compiler as valid code.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/53544] Derived-type components in namelist group declaration produces error
  2012-05-31 18:51 [Bug fortran/53544] New: Derived-type components in namelist group declaration produces error townsend at astro dot wisc.edu
@ 2012-05-31 20:12 ` anlauf at gmx dot de
  2012-05-31 21:09 ` anlauf at gmx dot de
  2012-10-29 16:10 ` janus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gmx dot de @ 2012-05-31 20:12 UTC (permalink / raw)
  To: gcc-bugs

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

Harald Anlauf <anlauf at gmx dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gmx dot de

--- Comment #1 from Harald Anlauf <anlauf at gmx dot de> 2012-05-31 20:07:37 UTC ---
Why don't you simply write 
    namelist /bar/ ct
?

Anyway, neither the NAG nor the Intel compiler accept your program:

% nagfor pr53544.f90
NAG Fortran Compiler Release 5.3(854)
Error: pr53544.f90, line 12: Syntax error
       detected at CT@%
***Malformed statement
[NAG Fortran Compiler pass 1 error termination, 1 error]


% ifort pr53544.f90 -V    
Intel(R) Fortran Compiler XE for applications running on IA-32, Version
12.1.4.319 Build 20120410
Copyright (C) 1985-2012 Intel Corporation.  All rights reserved.
FOR NON-COMMERCIAL USE ONLY

 Intel(R) Fortran 12.1-2100
pr53544.f90(12): error #5082: Syntax error, found '%' when expecting one of: ,
<END-OF-STATEMENT> ; /
  namelist /bar/ ct%a, ct%b
-------------------^
pr53544.f90(12): error #5082: Syntax error, found '%' when expecting one of: ,
<END-OF-STATEMENT> ; /
  namelist /bar/ ct%a, ct%b
-------------------------^
pr53544.f90(12): error #6404: This name does not have a type, and must have an
explicit type.   [A]
  namelist /bar/ ct%a, ct%b
--------------------^
pr53544.f90(12): error #6404: This name does not have a type, and must have an
explicit type.   [B]
  namelist /bar/ ct%a, ct%b
--------------------------^
compilation aborted for pr53544.f90 (code 1)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/53544] Derived-type components in namelist group declaration produces error
  2012-05-31 18:51 [Bug fortran/53544] New: Derived-type components in namelist group declaration produces error townsend at astro dot wisc.edu
  2012-05-31 20:12 ` [Bug fortran/53544] " anlauf at gmx dot de
@ 2012-05-31 21:09 ` anlauf at gmx dot de
  2012-10-29 16:10 ` janus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gmx dot de @ 2012-05-31 21:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Harald Anlauf <anlauf at gmx dot de> 2012-05-31 20:27:26 UTC ---
(In reply to comment #0)
> It is my understanding that the variables in a namelist group declaration must
> not be a dummy array with non-constant bound, a variable with non-constant
> character length, an automatic object, an allocatable array, a pointer, or have
> a component at any depth that is a pointer or is inaccessible. The case in the
> example program falls into none of these categories, and therefore should be
> accepted by the compiler as valid code.

>From the F2008 draft standard:

R564 namelist-group-object is variable-name

R603 variable-name               is  name

C603 (R603) variable-name shall be the name of a variable.


I think that ct%a is a structure component and does not
qualify as the name of a variable.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/53544] Derived-type components in namelist group declaration produces error
  2012-05-31 18:51 [Bug fortran/53544] New: Derived-type components in namelist group declaration produces error townsend at astro dot wisc.edu
  2012-05-31 20:12 ` [Bug fortran/53544] " anlauf at gmx dot de
  2012-05-31 21:09 ` anlauf at gmx dot de
@ 2012-10-29 16:10 ` janus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: janus at gcc dot gnu.org @ 2012-10-29 16:10 UTC (permalink / raw)
  To: gcc-bugs


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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |janus at gcc dot gnu.org
         Resolution|                            |INVALID

--- Comment #3 from janus at gcc dot gnu.org 2012-10-29 16:10:17 UTC ---
(In reply to comment #2)
> I think that ct%a is a structure component and does not
> qualify as the name of a variable.

Right. Also our error message is not worse than that of other compilers, so I
think this can be closed as INVALID.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-29 16:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-31 18:51 [Bug fortran/53544] New: Derived-type components in namelist group declaration produces error townsend at astro dot wisc.edu
2012-05-31 20:12 ` [Bug fortran/53544] " anlauf at gmx dot de
2012-05-31 21:09 ` anlauf at gmx dot de
2012-10-29 16:10 ` janus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).