[Bug fortran/55117] Programs fails to read namelist (contains derived types objects)

tilo@tilo-schwarz.de gcc-bugzilla@gcc.gnu.org
Mon Feb 25 01:03:00 GMT 2013


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

--- Comment #15 from Tilo Schwarz <tilo@tilo-schwarz.de> 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



More information about the Gcc-bugs mailing list