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]

[Patch,Fortran,committed] PR 43298 - Use NAN not NAN(...) for strtod


Seemingly HPUX's strtod does not like "NAN(alphanum)" which is allowed
according to POSIX but what it does is implementation defined.

Well, as it does not work, I use the simplest (implementation defined)
solution: I only pass NAN to strtod - ignoring the (...) part.

The patch was reviewed by Jerry in the PR and build/regtested on
x86-64-linux.
Committed as Rev. 161735.

Tobias
Index: libgfortran/ChangeLog
===================================================================
--- libgfortran/ChangeLog	(Revision 161734)
+++ libgfortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,9 @@
+2010-06-28  Tobias Burnus  <burnus@net-b.de>
+
+	PR fortran/43298
+	* list_read.c (parse_real): Do not pass (..) on for NAN(..).
+	* read.c (convert_real): Fix comment about NAN/INF.
+
 2010-07-02  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
 	* configure.ac (gfortran_use_symver): Only check for Sun-style symbol
Index: libgfortran/io/list_read.c
===================================================================
--- libgfortran/io/list_read.c	(Revision 161734)
+++ libgfortran/io/list_read.c	(Arbeitskopie)
@@ -1206,10 +1206,7 @@ parse_real (st_parameter_dt *dtp, void *
 	  for ( ; c != ')'; c = next_char (dtp))
 	    if (is_separator (c))
 	      goto bad;
-	    else
-	      push_char (dtp, c);
 
-	  push_char (dtp, ')');
 	  c = next_char (dtp);
 	  if (is_separator (c))
 	    unget_char (dtp, c);
Index: libgfortran/io/read.c
===================================================================
--- libgfortran/io/read.c	(Revision 161734)
+++ libgfortran/io/read.c	(Arbeitskopie)
@@ -131,11 +131,10 @@ max_value (int length, int signed_flag)
 
 
 /* convert_real()-- Convert a character representation of a floating
- * point number to the machine number.  Returns nonzero if there is a
- * range problem during conversion.  Note: many architectures
- * (e.g. IA-64, HP-PA) require that the storage pointed to by the dest
- * argument is properly aligned for the type in question.  TODO:
- * handle not-a-numbers and infinities.  */
+   point number to the machine number.  Returns nonzero if there is a
+   range problem during conversion.  Note: many architectures
+   (e.g. IA-64, HP-PA) require that the storage pointed to by the dest
+   argument is properly aligned for the type in question.  */
 
 int
 convert_real (st_parameter_dt *dtp, void *dest, const char *buffer, int length)

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