Module Name:    src
Committed By:   riz
Date:           Fri Jul 16 19:03:21 UTC 2010

Modified Files:
        src/gnu/dist/binutils/gas [netbsd-5]: atof-generic.c
        src/gnu/dist/binutils/gas/config [netbsd-5]: atof-vax.c

Log Message:
Pull up following revision(s) (requested by jklos in ticket #1427):
        gnu/dist/binutils/gas/config/atof-vax.c
        gnu/dist/binutils/gas/atof-generic.c
>From Matt Thomas, suggested upstream:
        * atof-generic.c (atof_generic): recognize snan and qnan in
        addition to nan and inf.
        * atof-vax.c (flonum_gen2vax): deal properly with nan, snan, qnan,
        and +Inf and -Inf codes.
This fixes PR toolchain/43303.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.26.1 \
    src/gnu/dist/binutils/gas/atof-generic.c
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.38.1 \
    src/gnu/dist/binutils/gas/config/atof-vax.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/gnu/dist/binutils/gas/atof-generic.c
diff -u src/gnu/dist/binutils/gas/atof-generic.c:1.1.1.3 src/gnu/dist/binutils/gas/atof-generic.c:1.1.1.3.26.1
--- src/gnu/dist/binutils/gas/atof-generic.c:1.1.1.3	Thu Feb  2 20:55:07 2006
+++ src/gnu/dist/binutils/gas/atof-generic.c	Fri Jul 16 19:03:21 2010
@@ -123,6 +123,32 @@
 
   switch (first_digit[0])
     {
+    case 's':
+    case 'S':
+	if (!strncasecmp ("snan", first_digit, 4))
+	{
+	  address_of_generic_floating_point_number->sign = 0;
+	  address_of_generic_floating_point_number->exponent = 0;
+	  address_of_generic_floating_point_number->leader =
+	    address_of_generic_floating_point_number->low;
+	  *address_of_string_pointer = first_digit + 4;
+	  return 0;
+	}
+      break;
+
+    case 'q':
+    case 'Q':
+      if (!strncasecmp ("qnan", first_digit, 4))
+	{
+	  address_of_generic_floating_point_number->sign = 0;
+	  address_of_generic_floating_point_number->exponent = 0;
+	  address_of_generic_floating_point_number->leader =
+	    address_of_generic_floating_point_number->low;
+	  *address_of_string_pointer = first_digit + 4;
+	  return 0;
+	}
+      break;
+
     case 'n':
     case 'N':
       if (!strncasecmp ("nan", first_digit, 3))

Index: src/gnu/dist/binutils/gas/config/atof-vax.c
diff -u src/gnu/dist/binutils/gas/config/atof-vax.c:1.1.1.1 src/gnu/dist/binutils/gas/config/atof-vax.c:1.1.1.1.38.1
--- src/gnu/dist/binutils/gas/config/atof-vax.c:1.1.1.1	Wed Nov 26 11:34:23 2003
+++ src/gnu/dist/binutils/gas/config/atof-vax.c	Fri Jul 16 19:03:21 2010
@@ -292,10 +292,27 @@
 	  int exponent_skippage;
 	  LITTLENUM_TYPE word1;
 
-	  /* JF: Deal with new Nan, +Inf and -Inf codes */
 	  if (f->sign != '-' && f->sign != '+')
 	    {
-	      make_invalid_floating_point_number (words);
+	      if (f->sign == 0)
+		{
+		  /* All NaNs are 0.  */
+		  memset (words, 0x00, sizeof (LITTLENUM_TYPE) * precision);
+		}
+	      else if (f->sign == 'P')
+		{
+		  /* Positive Infinity.  */
+		  memset (words, 0xff, sizeof (LITTLENUM_TYPE) * precision);
+		  words[0] &= 0x7fff;
+		}
+	      else if (f->sign == 'N')
+		{
+		  /* Negative Infinity.  */
+		  memset (words, 0x00, sizeof (LITTLENUM_TYPE) * precision);
+		  words[0] = 0x0080;
+		}
+	      else
+		make_invalid_floating_point_number (words);
 	      return return_value;
 	    }
 	  /*

Reply via email to