public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tilo@tilo-schwarz.de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/55117] Programs fails to read namelist (contains derived types objects)
Date: Fri, 22 Feb 2013 20:58:00 -0000	[thread overview]
Message-ID: <bug-55117-4-2xXtE1kjLG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-55117-4@http.gcc.gnu.org/bugzilla/>


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

Tilo Schwarz <tilo@tilo-schwarz.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tilo@tilo-schwarz.de

--- Comment #11 from Tilo Schwarz <tilo@tilo-schwarz.de> 2013-02-22 20:57:50 UTC ---
Hi,

I ran into this today and tried to produce a small test case from my big
namelist problem.


program namelist

type d1
    integer :: j = 0
end type d1

type d2
    type(d1) k
end type d2

type d3
    type(d2) d(2)
end type d3

type(d3) der
namelist /nmlst/ der

read (*, nml = nmlst)
print nmlst

end program namelist


Running above program on all two line combinations of the namelist gives
different errors using
4.7.2 and
gcc version 4.8.0 20130222 (experimental) (GCC)
(Details below).


Observations:

- If type d3 uses 'type(d1) d(2)' instead of 'type(d2) d(2)', the problem goes
away.
- If the trailing %J is removed in the namelist, the problem goes away.
- If two separate members are used instead of the array 'type(d2) d(2)', the
problem goes away.


Details of namelist variations:

% cat namelist.txt; echo -------; prg_namelist_bug < namelist.txt
&NMLST
 /
-------
&NMLST
 DER%D(1)%K%J=          0,
 DER%D(2)%K%J=          0,
 /


% cat namelist.txt; echo -------; prg_namelist_bug < namelist.txt
&NMLST
 DER%D(1)%K%J = 1,
 /
-------
&NMLST
 DER%D(1)%K%J=          1,
 DER%D(2)%K%J=          0,
 /


% cat namelist.txt; echo -------; prg_namelist_bug < namelist.txt
&NMLST
 DER%D(2)%K%J = 2,
 /
-------
&NMLST
 DER%D(1)%K%J=          2,
 DER%D(2)%K%J=          0,
 /


% cat namelist.txt; echo -------; prg_namelist_bug < namelist.txt
&NMLST
 DER%D(1)%K%J = 1,
 DER%D(2)%K%J = 2,
 /
-------
&NMLST
 DER%D(1)%K%J=          2,
 DER%D(2)%K%J=          0,
 /


% cat namelist.txt; echo -------; prg_namelist_bug < namelist.txt
&NMLST
 DER%D(2)%K%J = 2,
 DER%D(1)%K%J = 1,
 /
-------
&NMLST
 DER%D(1)%K%J=          1,
 DER%D(2)%K%J=          0,
 /


If the last component %J is removed in the namelist,
the problem goes away:

% cat namelist.txt; echo -------; prg_namelist_bug < namelist.txt
&NMLST
 DER%D(1)%K = 1,
 /
-------
&NMLST
 DER%D(1)%K%J=          1,
 DER%D(2)%K%J=          0,
 /


% cat namelist.txt; echo -------; prg_namelist_bug < namelist.txt
&NMLST
 DER%D(2)%K = 2,
 /
-------
&NMLST
 DER%D(1)%K%J=          0,
 DER%D(2)%K%J=          2,
 /


% cat namelist.txt; echo -------; prg_namelist_bug < namelist.txt
&NMLST
 DER%D(1)%K = 1,
 DER%D(2)%K = 2,
 /
-------
&NMLST
 DER%D(1)%K%J=          1,
 DER%D(2)%K%J=          2,
 /


% cat namelist.txt; echo -------; prg_namelist_bug < namelist.txt
&NMLST
 DER%D(2)%K = 2,
 DER%D(1)%K = 1,
 /
-------
&NMLST
 DER%D(1)%K%J=          1,
 DER%D(2)%K%J=          2,
 /


Regards,
Tilo


  parent reply	other threads:[~2013-02-22 20:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-29 14:31 [Bug fortran/55117] New: " pmarguinaud at hotmail dot com
2012-10-29 14:32 ` [Bug fortran/55117] " pmarguinaud at hotmail dot com
2012-10-29 14:34 ` pmarguinaud at hotmail dot com
2012-10-29 16:03 ` janus at gcc dot gnu.org
2012-10-31 19:53 ` burnus at gcc dot gnu.org
2013-01-04  2:54 ` w6ws at earthlink dot net
2013-01-04 14:33 ` w6ws at earthlink dot net
2013-01-04 16:59 ` kargl at gcc dot gnu.org
2013-01-04 17:22 ` w6ws at earthlink dot net
2013-01-05 19:16 ` jvdelisle at gcc dot gnu.org
2013-01-06 18:51 ` jvdelisle at gcc dot gnu.org
2013-02-22 20:58 ` tilo@tilo-schwarz.de [this message]
2013-02-22 22:40 ` tilo@tilo-schwarz.de
2013-02-24  0:28 ` tilo@tilo-schwarz.de
2013-02-25  1:00 ` tilo@tilo-schwarz.de
2013-02-25  1:03 ` tilo@tilo-schwarz.de
2013-02-25 19:02 ` tilo@tilo-schwarz.de
2013-02-25 19:49 ` mikael at gcc dot gnu.org
2013-02-25 20:29 ` tilo@tilo-schwarz.de
2013-03-22 10:10 ` burnus at gcc dot gnu.org
2013-03-30  3:54 ` jvdelisle at gcc dot gnu.org
2013-03-30  5:05 ` jvdelisle at gcc dot gnu.org
2013-04-25 12:42 ` burnus at gcc dot gnu.org
2013-06-16 18:04 ` dominiq at lps dot ens.fr
2014-03-23 23:20 ` jvdelisle at gcc dot gnu.org
2014-05-26 15:20 ` jvdelisle at gcc dot gnu.org
2014-05-26 15:33 ` jvdelisle at gcc dot gnu.org
2014-06-07 17:42 ` jvdelisle at gcc dot gnu.org
2014-06-07 17:43 ` jvdelisle at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-55117-4-2xXtE1kjLG@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).