From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7793 invoked by alias); 25 Feb 2013 01:03:15 -0000 Received: (qmail 7668 invoked by uid 48); 25 Feb 2013 01:02:48 -0000 From: "tilo@tilo-schwarz.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/55117] Programs fails to read namelist (contains derived types objects) Date: Mon, 25 Feb 2013 01:03:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: tilo@tilo-schwarz.de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jvdelisle at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-02/txt/msg02326.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55117 --- Comment #15 from Tilo Schwarz 2013-02-25 01:02:45 UTC --- This week I used the Fortran namelist feature for the first time and I was really impressed, that it does all the parsing for me. But since I ran into this issue I was wondering and curious how the magic in libgfortran works. I had a look at the code and could observe the following: If I apply the attached patch (comment 14, namelist.diff) on gcc version 4.8.0 20130224 - my example from comment 11 works - the example from comment 3 seems to work - the changed namelist_64.f90 from comment 13 works - the example from PR 51825 seems to work - make check-fortran runs with no additional errors - the example from comment 6 (type extension) does not work The type extension problem might be related to the fact, that gfortran does not generate a namelist entry for the implicit component %x of t1e_t: (no "t1e%x" below) _gfortran_st_set_nml_var (&dt_parm.1, &t1e, &"t1e"[1]{lb: 1 sz: 1}, 0, 0, 40); ... maybe "t1e%x" should be here? ... _gfortran_st_set_nml_var (&dt_parm.1, &t1e.t1_t, &"t1e%t1_t"[1]{lb: 1 sz: 1}, 0, 0, 40); _gfortran_st_set_nml_var (&dt_parm.1, &t1e.t1_t.x, &"t1e%t1_t%x"[1]{lb: 1 sz: 1}, 4, 0, 24); _gfortran_st_set_nml_var (&dt_parm.1, &t1e.string, &"t1e%string"[1]{lb: 1 sz: 1}, 1, 8, 48); _gfortran_st_set_nml_var (&dt_parm.1, &answer, &"answer"[1]{lb: 1 sz: 1}, 4, 0, 8); So maybe this patch gives a hint to someone, who has a deeper understanding of the io-stuff than me (looked at it this weekend for the first time) ... Tilo