https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125095
--- Comment #10 from Steve Kargl <kargl at gcc dot gnu.org> ---
(In reply to Andy Nelson from comment #9)
> adding a statement to define 'themsg' to the snippet I sent in does not
> change the behavior of the namelist read, in terms of the values it reads in
> for nml3.
I did not state that it did. I simply pointed out the code
is nonconforming, which in the extreme means the compiled
code can do anything and the behavior is correct.
> On that basis, I'd claim that the bug report is still valid/active. Yes?
Yes, there is a bug. See comment #2 where I changed the status from
unconfirmed to new and gave you a possible workaround (ie. remove
the commas in nml3).
In fact, the bug is associated with a comma followed by comment.
Remove the commas on the comment lines and things work.
Change to
&nml2
barray = 5., ! comment
6.,
7. ! another comment
8.,
% gfcx -o z -finit-real=inf nmlbug.f90 && ./z
status a 0
errmsg: No error
1.00000000 2.00000000 3.00000000 4.00000000
status b 5010
errmsg: Cannot match namelist object name 8.&nml3
5.00000000 Infinity 6.00000000 7.00000000
So, the eating of ", ! comment\n' is actually skipping one of the
array elements.