This is the mail archive of the gcc-patches@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]

Re: [patch, libfortran] PR34427 namelist input of inf-nan


Jerry DeLisle wrote:
> 2007-12-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
>
>     PR fortran/34427
>     * io/list_read.c (read_real): Handle intervening line ends and
> spaces.
>     (get_name): Don't push separators to saved_string.
>     (eat_separator): If in namelist mode eat spaces and line ends as
> well.
The patch is OK, but I have some comments/questions:

@@ -316,6 +316,13 @@ eat_separator (st_parameter_dt *dtp)
 
     case '\n':
       dtp->u.p.at_eol = 1;
+      if (dtp->u.p.namelist_mode)
+	{
+	  do
+	    c = next_char (dtp);
+	  while (c == '\n' || c == '\r' || c == ' ');
+	  unget_char (dtp, c);
+	}
       break;


I wonder whether one should do something similar for '\r'. If I recall
correctly, the normal line-break character on MacOS was (is?) '\r'
(while Unix has '\n' and Windows "\r\n").


Additionally, I think one can replace:

 exp2:
  if (!isdigit (c))
    {
      if (c == 'i' || c == 'I' || c == 'n' || c == 'N')
        goto inf_nan;
      else
        goto bad;
    }

by

 exp2:
  if (!isdigit (c))
    goto bad;

I changed this in my original Inf/NaN patch to the upper version, but
you correctly remarked that it does not make much sense to have it for
exp2. (But I forgot to change it back when I checked the patch in.) You
can undo my change if you want.

Tobias


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