public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/37707]  New: Namelist read of array of derived type incorrect
@ 2008-10-01 21:01 toon at moene dot indiv dot nluug dot nl
  2008-10-01 21:43 ` [Bug libfortran/37707] " burnus at gcc dot gnu dot org
                   ` (34 more replies)
  0 siblings, 35 replies; 36+ messages in thread
From: toon at moene dot indiv dot nluug dot nl @ 2008-10-01 21:01 UTC (permalink / raw)
  To: gcc-bugs

The following program:

type s
   integer m
   integer n
end type s
type(s) :: a(3)
character*80 :: l = ' &namlis a%m=1,2, a%n=5,6, /'
namelist /namlis/ a
a%m=[87,88,89]
a%n=[97,98,99]
print*,a%m
print*,a%n
read(l,namlis)
write(*,namlis)
end

prints:

          87          88          89
          97          98          99
At line 12 of file nl.f90
Fortran runtime error: Cannot match namelist object name 2

The error condition is bogus. According to the Fortran 2003 Standard, subclause
10.10.1.2 (third paragraph):

"When the name in the input record represents an array variable or a variable
of derived type, the effect is as if the variable represented where expanded
into a sequence of scalar list items of intrinsic data types, in the same way
that formatted input/output list items are expanded."

In other words: a%m has to be read in in the same way as it has to be written
out. That means that the original namelist read above should assign 1 to a(1)%m
and 2 to a(2)%m and nothing (i.e., not change the value of a(3)%m) and, mutatis
mutandis, for a(..)%n.


-- 
           Summary: Namelist read of array of derived type incorrect
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: toon at moene dot indiv dot nluug dot nl


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


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

end of thread, other threads:[~2008-10-29  4:50 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-01 21:01 [Bug libfortran/37707] New: Namelist read of array of derived type incorrect toon at moene dot indiv dot nluug dot nl
2008-10-01 21:43 ` [Bug libfortran/37707] " burnus at gcc dot gnu dot org
2008-10-02  1:48 ` jvdelisle at gcc dot gnu dot org
2008-10-09  2:41 ` jvdelisle at gcc dot gnu dot org
2008-10-09  4:05 ` jvdelisle at gcc dot gnu dot org
2008-10-09  4:17 ` jvdelisle at gcc dot gnu dot org
2008-10-09  9:16 ` pault at gcc dot gnu dot org
2008-10-09  9:28 ` dominiq at lps dot ens dot fr
2008-10-09 13:33 ` burnus at gcc dot gnu dot org
2008-10-10  2:12 ` jvdelisle at gcc dot gnu dot org
2008-10-10  2:15 ` jvdelisle at gcc dot gnu dot org
2008-10-18  5:26 ` jvdelisle at gcc dot gnu dot org
2008-10-18  5:37 ` jvdelisle at gcc dot gnu dot org
2008-10-18  8:44 ` toon at moene dot indiv dot nluug dot nl
2008-10-18  8:48 ` toon at moene dot indiv dot nluug dot nl
2008-10-18  8:48 ` toon at moene dot indiv dot nluug dot nl
2008-10-18 14:35 ` burnus at gcc dot gnu dot org
2008-10-18 14:54 ` burnus at gcc dot gnu dot org
2008-10-18 15:14 ` burnus at gcc dot gnu dot org
2008-10-18 15:34 ` toon at moene dot indiv dot nluug dot nl
2008-10-18 17:48 ` jvdelisle at gcc dot gnu dot org
2008-10-18 21:49 ` jvdelisle at gcc dot gnu dot org
2008-10-19  9:46 ` burnus at gcc dot gnu dot org
2008-10-19 15:31 ` jvdelisle at gcc dot gnu dot org
2008-10-19 15:33 ` jvdelisle at gcc dot gnu dot org
2008-10-19 15:41 ` jvdelisle at gcc dot gnu dot org
2008-10-19 16:12 ` toon at moene dot indiv dot nluug dot nl
2008-10-19 18:17 ` jvdelisle at gcc dot gnu dot org
2008-10-22  8:30 ` toon at moene dot indiv dot nluug dot nl
2008-10-23  2:33 ` jvdelisle at gcc dot gnu dot org
2008-10-23  2:45 ` jvdelisle at gcc dot gnu dot org
2008-10-23  2:51 ` jvdelisle at gcc dot gnu dot org
2008-10-23  6:20 ` burnus at gcc dot gnu dot org
2008-10-29  4:47 ` jvdelisle at gcc dot gnu dot org
2008-10-29  4:49 ` jvdelisle at gcc dot gnu dot org
2008-10-29  4:50 ` jvdelisle at gcc dot gnu 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).