Module Name: src
Committed By: martin
Date: Sun May 16 11:20:01 UTC 2010
Modified Files:
src/external/gpl3/binutils/dist/gas: atof-generic.c
src/external/gpl3/binutils/dist/gas/config: atof-vax.c
Log Message:
>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.1 -r1.2 \
src/external/gpl3/binutils/dist/gas/atof-generic.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/binutils/dist/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/external/gpl3/binutils/dist/gas/atof-generic.c
diff -u src/external/gpl3/binutils/dist/gas/atof-generic.c:1.1.1.1 src/external/gpl3/binutils/dist/gas/atof-generic.c:1.2
--- src/external/gpl3/binutils/dist/gas/atof-generic.c:1.1.1.1 Tue Aug 18 09:29:47 2009
+++ src/external/gpl3/binutils/dist/gas/atof-generic.c Sun May 16 11:20:01 2010
@@ -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))
Index: src/external/gpl3/binutils/dist/gas/config/atof-vax.c
diff -u src/external/gpl3/binutils/dist/gas/config/atof-vax.c:1.1.1.1 src/external/gpl3/binutils/dist/gas/config/atof-vax.c:1.2
--- src/external/gpl3/binutils/dist/gas/config/atof-vax.c:1.1.1.1 Tue Aug 18 09:33:37 2009
+++ src/external/gpl3/binutils/dist/gas/config/atof-vax.c Sun May 16 11:20:01 2010
@@ -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;
}