Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/binutils/dist/gas From Matt Thomas, suggested ...



details:   https://anonhg.NetBSD.org/src/rev/70476fed2781
branches:  trunk
changeset: 754926:70476fed2781
user:      martin <martin%NetBSD.org@localhost>
date:      Sun May 16 11:20:01 2010 +0000

description:
>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.

diffstat:

 external/gpl3/binutils/dist/gas/atof-generic.c    |  26 +++++++++++++++++++++++
 external/gpl3/binutils/dist/gas/config/atof-vax.c |  21 ++++++++++++++++-
 2 files changed, 45 insertions(+), 2 deletions(-)

diffs (69 lines):

diff -r 5019d07a47fa -r 70476fed2781 external/gpl3/binutils/dist/gas/atof-generic.c
--- a/external/gpl3/binutils/dist/gas/atof-generic.c    Sun May 16 08:56:17 2010 +0000
+++ b/external/gpl3/binutils/dist/gas/atof-generic.c    Sun May 16 11:20:01 2010 +0000
@@ -121,6 +121,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))
diff -r 5019d07a47fa -r 70476fed2781 external/gpl3/binutils/dist/gas/config/atof-vax.c
--- a/external/gpl3/binutils/dist/gas/config/atof-vax.c Sun May 16 08:56:17 2010 +0000
+++ b/external/gpl3/binutils/dist/gas/config/atof-vax.c Sun May 16 11:20:01 2010 +0000
@@ -268,10 +268,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;
            }
 



Home | Main Index | Thread Index | Old Index