This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/34427] [4.3 Regression] Revision 130708 breaks namelist input



------- Comment #17 from kargl at gcc dot gnu dot org  2007-12-11 23:31 -------
(In reply to comment #16)
> > 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.
> 

Tobias,

Can you use the method used in many of the gfc_match_* fucntions.

   locus old_locus;

   old_locus = current_locus;
   if (check for Inf/Nan)
     {
     }

bad_infnan:
   current_locus = old_locus;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34427


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]