[Bug fortran/82086] namelist read with repeat count fails when item is member of array of structures
jvdelisle at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jan 29 03:36:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82086
--- Comment #6 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
(In reply to Harald Anlauf from comment #4)
> (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?
>
My interpretation, and I am probably wrong, is that the left hand side of the
assignment ta(1:8)%c = 8*'bogus' is an array section but we are currently
trying to assign all the 8 "bogus" strings into the first element of the array
since we have not given any array qualifiers on the right hand side.
I see from your expanded example that gfortran does the same thing NAG does. If
we let gfortran write the namelist, we get this:
&N
TA(1)%C="bogus ",
TA(2)%C="bogus ",
TA(3)%C="bogus ",
TA(4)%C="bogus ",
TA(5)%C="bogus ",
TA(6)%C="bogus ",
TA(7)%C="bogus ",
TA(8)%C="bogus ",
/
which is not ambiguous. I am not arguing either way now, but how does one
interpret these two cases:
ta(1:8)%c = 'bogus'
tb(1:8)%c = 8*'bogus'
The first case without the repeat count seems unambiguous to me which leads me
to question the validity of the case with the repeat count.
More information about the Gcc-bugs
mailing list