[Bug fortran/82086] namelist read with repeat count fails when item is member of array of structures
anlauf at gmx dot de
gcc-bugzilla@gcc.gnu.org
Sun Jan 28 21:17:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82086
--- Comment #4 from Harald Anlauf <anlauf at gmx dot de> ---
(In reply to Jerry DeLisle from comment #3)
> I think this bug is invalid and gfortran is correct.
>
> If you do this:
>
> &n
> ta(1:8)%c = 'bogus'
> /
>
> You get what you expect. The way you have it, you can not put 8 strings
> called 'bogus' into one strng element of ta.
>
> Anyine else have any thoughts on this?
Can you please elaborate in more detail?
For the slightly modified testcase & data:
% cat pr82086b.f90
program pr82086
implicit none
type t
character(8) :: c=''
end type t
type(t), dimension(9) :: ta
type(t), dimension(9) :: tb
type(t), dimension(9) :: tc
character(8), dimension(9) :: td = ""
namelist /n/ta, tb, tc, td
open(1,file='pr82086b.txt')
read(1,nml=n)
print *, ta%c
print *, tb%c
print *, tc%c
print *, td
end program pr82086
% cat pr82086b.txt
&n
ta(1:8)%c = 'bogus'
tb(1:8)%c = 8*'bogus'
tc(1:8)%c = 'bogus','bogus','bogus','bogus','bogus','bogus','bogus','bogus'
td(1:8) = 8*'bogus'
/
I get with Intel v15, v17, PGI 17.10, Sun 8.4:
bogus
bogus bogus bogus bogus bogus bogus bogus bogus
bogus bogus bogus bogus bogus bogus bogus bogus
bogus bogus bogus bogus bogus bogus bogus bogus
Cray 8.4.1 and 8.6.5 reject the second line (tb).
Can you explain the subleties in more detail why the repeat does not
work as naively expected?
More information about the Gcc-bugs
mailing list