This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


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

Re: RFA: strtod patch


Mark Mitchell <mark@codesourcery.com> writes:

> It turns out that the C strtod library function used in libjava was
> broken.  The code removed by this patch had the effect of causing
> a 0 exponent to result in EINVAL, which does not make sense to me.

The patch looks wrong.  The problem is not the error result code,
but some mis-placed braces.  Could you try out the following
(which I've only verified that it compiles)?

Index: strtod.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/strtod.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 strtod.c
--- strtod.c	1999/04/07 14:52:39	1.1.1.1
+++ strtod.c	2001/09/16 11:37:24
@@ -242,17 +242,17 @@
 	      if (esign)
 		e = -e;
 	    }
-	  else
-	    {
-	      /* No exponent after an 'E' : that's an error. */
-	      ptr->_errno = EINVAL;
-	      e = 0;
-	      goto ret;
-	    }
 	}
       else
-	s = s00;
+	{
+	  /* No exponent after an 'E' : that's an error. */
+	  ptr->_errno = EINVAL;
+	  e = 0;
+	  goto ret;
+	}
     }
+  else
+    s = s00;
   if (!nd)
     {
       if (!nz && !nz0)

-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/


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