This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/39668] Wrongly read namelist with two dimensional array.
- From: "toon at moene dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Aug 2009 16:40:06 -0000
- Subject: [Bug libfortran/39668] Wrongly read namelist with two dimensional array.
- References: <bug-39668-17017@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from toon at moene dot org 2009-08-18 16:40 -------
The relevant wording in the Standard (2003) is:
9.5.3.4 Data transfer
...
The list items for a namelist input statement are processed in the order of the
entities specified within the input records.
...
To spell it out for this example:
1 is assigned to i(1,1)
2 is assigned to i(2,1) ! Array element order, as no other order is specified.
3 is assigned to i(3,1) ! Ditto.
4 is assigned to i(2,1) ! Overwriting the 2 that was there.
5 is assigned to i(3,1) ! Overwriting the 3 that was there.
6 is assigned to i(2,2) ! Got that ?
7 is assigned to i(3,1) ! Overwriting the 5 that was there.
8 is assigned to i(3,2) ! Hah !
9 is assigned to i(3,3) ! So there !
i(1,2), i(1,3) and i(2,3) are never set via the namelist I/O and remain at 0.
So printing the namelist will get you: 1, 4, 7, 0 (=i(1,2)), 6, 8, 0 (=i(1,3)),
0 (=i(2,3)), 9
which seems perfectly OK with me.
Closing the bug report as INVALID, i.e., not a bug.
--
toon at moene dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39668