This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34427] [4.3 Regression] Revision 130708 breaks namelist input
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Dec 2007 22:47:23 -0000
- Subject: [Bug fortran/34427] [4.3 Regression] Revision 130708 breaks namelist input
- References: <bug-34427-682@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #16 from burnus at gcc dot gnu dot org 2007-12-11 22:47 -------
> Also are inf/infinity/infbar/infinityfoo/nan/nanfoo valid variables?
I think they are. But none which start with an integer or a '+'/'-'/'.', which
is why the old technique "Read a single character, if it is not valid, -
restore it and return" worked before.
The question is how to tackle this properly to allow for:
NAMELIST /nl/ foo
NAMELIST /nl/ infinity
open (10, status="scratch")
write (10,*) " &nl foo = 5, 5, 5, infinity, infinity"
write (10,*) " = 1, /"
(For this one, g95 also fails.)
I was thinking of something like:
if ((c == 'i' || c == 'I')
&& ((save[i++] = next_char (dtp)) == 'n' || save[i] == 'N')
&& ((save[i++] = next_char (dtp)) == 'f' || save[i] == 'F'))
[...]
unwind:
for (j = i; i >= 0; j--)
unget_char(dtp, save[j]);
but this does not work as one can only unget a single character:
unget_char (st_parameter_dt *dtp, char c)
{ dtp->u.p.last_char = c; }
For valid input, one needs to unget at least "INFINITY" + separator + (eat
whitespace) + separator, i.e. 9 to 10 characters.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34427