http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55117
Tilo Schwarz <t...@tilo-schwarz.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |t...@tilo-schwarz.de --- Comment #11 from Tilo Schwarz <t...@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