[Bug libfortran/43298] fortran library does not read in NaN -Inf or Inf

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Mar 12 12:31:00 GMT 2010



------- Comment #4 from burnus at gcc dot gnu dot org  2010-03-12 12:31 -------
Actually, in list_read.c's parse_real gfortran already handles inf(inity) and
nan (_but_ _not _"nan(string)"). Thus, using 'read(*,*) a' works.

 * * *

The TODO quote from comment 2 is for read.c's "convert_real"; however, as this
only calls strto(d,f,ld), I do not see a problem on POSIX/C99 systems. I think
the actual problem is read.c's "read_f" which cannot parse NaN/INF and gives a
"goto bad" error. I think one should do something similar to list_read.c's
parse_real.

For completeness, the strtod, strtof, strtold of C99/POSIX supports:
* One of INF or INFINITY, ignoring case
* One of NAN or NAN(n-char-sequence_opt), ignoring case in the NAN part, where:
          n-char-sequence:
              digit
              nondigit
              n-char-sequence digit
              n-char-sequence nondigit


-- 


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



More information about the Gcc-bugs mailing list