------- 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

Reply via email to