public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/39668]  New: Wrongly read namelist with two dimensional array.
@ 2009-04-06 20:36 toon at moene dot org
  2009-04-07  3:00 ` [Bug libfortran/39668] " jvdelisle at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: toon at moene dot org @ 2009-04-06 20:36 UTC (permalink / raw)
  To: gcc-bugs

Fortran code:

INTEGER :: i(3,3)

namelist/namtest/i

i=0

OPEN(10)
CLOSE(10)
READ(10,namtest)
WRITE(6,namtest)
END

Namelist in fort.10:

&namtest
 i(1,1)=1,2,3,
 i(2,1)=4,5,6,
 i(3,1)=7,8,9,
/

Print out of program:

&NAMTEST
 I=          1,          4,          7,          0,          6,
           8, 2*0          ,          9,
 /

Output should have been:

&NAMTEST
 I=          1,          4,          7,          2,          5,
             8,          3,          6,          9,
 /


-- 
           Summary: Wrongly read namelist with two dimensional array.
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: toon at moene dot org


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


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

* [Bug libfortran/39668] Wrongly read namelist with two dimensional array.
  2009-04-06 20:36 [Bug libfortran/39668] New: Wrongly read namelist with two dimensional array toon at moene dot org
@ 2009-04-07  3:00 ` jvdelisle at gcc dot gnu dot org
  2009-04-07  4:35 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-04-07  3:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jvdelisle at gcc dot gnu dot org  2009-04-07 02:59 -------
I see the problem in 4.3, 4.4, and 4.5.  I don't have a 4.2 around, can someone
check that to see if this is a regression.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jvdelisle at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-04-07 02:59:59
               date|                            |


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


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

* [Bug libfortran/39668] Wrongly read namelist with two dimensional array.
  2009-04-06 20:36 [Bug libfortran/39668] New: Wrongly read namelist with two dimensional array toon at moene dot org
  2009-04-07  3:00 ` [Bug libfortran/39668] " jvdelisle at gcc dot gnu dot org
@ 2009-04-07  4:35 ` burnus at gcc dot gnu dot org
  2009-04-07 18:41 ` toon at moene dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-04-07  4:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2009-04-07 04:35 -------
(In reply to comment #1)
> I see the problem in 4.3, 4.4, and 4.5.  I don't have a 4.2 around, can 
> someone check that to see if this is a regression.

4.1/4.2 show the same result.

openf95, g95, ifort, sunf95 all have the following (which differs from Toon's
expected result):
   &NAMTEST I = 1, 4, 7, 8, 9, 4*0 /

NAG f95 needs an extra "open(10)" and prints then:
  Invalid character '2' in NAMELIST input

I'm not sure whether the example is valid.


-- 


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


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

* [Bug libfortran/39668] Wrongly read namelist with two dimensional array.
  2009-04-06 20:36 [Bug libfortran/39668] New: Wrongly read namelist with two dimensional array toon at moene dot org
  2009-04-07  3:00 ` [Bug libfortran/39668] " jvdelisle at gcc dot gnu dot org
  2009-04-07  4:35 ` burnus at gcc dot gnu dot org
@ 2009-04-07 18:41 ` toon at moene dot org
  2009-04-11 16:28 ` jvdelisle at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: toon at moene dot org @ 2009-04-07 18:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from toon at moene dot org  2009-04-07 18:41 -------
Note that the namelist is overwriting earlier assignments, so it's doubtful
it's legal Fortran.

The original that got my colleague questioning gfortran was:

&namtest
 i(1,:)=1,2,3,
 i(2,:)=4,5,6,
 i(3,:)=7,8,9,
/

which, using gfortran version 4.3.3, gave the same (but for this example wrong)
results as the namelist submitted in this bug report.

gfortran 4.[45] does *this* one right.

So it might be a red herring - put bug report in waiting until I figured out
the exact language in the Standard that either allows or disallows the original
namelist.


-- 

toon at moene dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |WAITING


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


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

* [Bug libfortran/39668] Wrongly read namelist with two dimensional array.
  2009-04-06 20:36 [Bug libfortran/39668] New: Wrongly read namelist with two dimensional array toon at moene dot org
                   ` (2 preceding siblings ...)
  2009-04-07 18:41 ` toon at moene dot org
@ 2009-04-11 16:28 ` jvdelisle at gcc dot gnu dot org
  2009-05-05 13:33 ` toon at moene dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-04-11 16:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jvdelisle at gcc dot gnu dot org  2009-04-11 16:28 -------
Un-assigning, I don't think this is a bug, yet.  :)


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|jvdelisle at gcc dot gnu dot|unassigned at gcc dot gnu
                   |org                         |dot org
             Status|WAITING                     |NEW


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


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

* [Bug libfortran/39668] Wrongly read namelist with two dimensional array.
  2009-04-06 20:36 [Bug libfortran/39668] New: Wrongly read namelist with two dimensional array toon at moene dot org
                   ` (3 preceding siblings ...)
  2009-04-11 16:28 ` jvdelisle at gcc dot gnu dot org
@ 2009-05-05 13:33 ` toon at moene dot org
  2009-08-15  2:06 ` jvdelisle at gcc dot gnu dot org
  2009-08-18 16:40 ` toon at moene dot org
  6 siblings, 0 replies; 8+ messages in thread
From: toon at moene dot org @ 2009-05-05 13:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from toon at moene dot org  2009-05-05 13:33 -------
Hmm, I said I'd put it in waiting until I found the definite wording in the
Standard about this use of namelist values ...


-- 

toon at moene dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


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


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

* [Bug libfortran/39668] Wrongly read namelist with two dimensional array.
  2009-04-06 20:36 [Bug libfortran/39668] New: Wrongly read namelist with two dimensional array toon at moene dot org
                   ` (4 preceding siblings ...)
  2009-05-05 13:33 ` toon at moene dot org
@ 2009-08-15  2:06 ` jvdelisle at gcc dot gnu dot org
  2009-08-18 16:40 ` toon at moene dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-08-15  2:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jvdelisle at gcc dot gnu dot org  2009-08-15 02:06 -------
Toon, any word on this?


-- 


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


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

* [Bug libfortran/39668] Wrongly read namelist with two dimensional array.
  2009-04-06 20:36 [Bug libfortran/39668] New: Wrongly read namelist with two dimensional array toon at moene dot org
                   ` (5 preceding siblings ...)
  2009-08-15  2:06 ` jvdelisle at gcc dot gnu dot org
@ 2009-08-18 16:40 ` toon at moene dot org
  6 siblings, 0 replies; 8+ messages in thread
From: toon at moene dot org @ 2009-08-18 16:40 UTC (permalink / raw)
  To: gcc-bugs



------- 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


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

end of thread, other threads:[~2009-08-18 16:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-06 20:36 [Bug libfortran/39668] New: Wrongly read namelist with two dimensional array toon at moene dot org
2009-04-07  3:00 ` [Bug libfortran/39668] " jvdelisle at gcc dot gnu dot org
2009-04-07  4:35 ` burnus at gcc dot gnu dot org
2009-04-07 18:41 ` toon at moene dot org
2009-04-11 16:28 ` jvdelisle at gcc dot gnu dot org
2009-05-05 13:33 ` toon at moene dot org
2009-08-15  2:06 ` jvdelisle at gcc dot gnu dot org
2009-08-18 16:40 ` toon at moene dot 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).