aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/atof-generic.c11
-rw-r--r--gas/testsuite/gas/i386/fp.d8
-rw-r--r--gas/testsuite/gas/i386/fp.s5
4 files changed, 23 insertions, 8 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index d9ad649..9117918 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,10 @@
+2019-11-20 Alan Modra <amodra@gmail.com>
+
+ PR 24944
+ * atof-generic.c (atof_generic): Increase decimal guard digits.
+ * testsuite/gas/i386/fp.s: Add more tests.
+ * testsuite/gas/i386/fp.d: Update.
+
2019-11-18 Andrew Burgess <andrew.burgess@embecosm.com>
* as.c (parse_args): Parse --gdwarf-cie-version option.
diff --git a/gas/atof-generic.c b/gas/atof-generic.c
index 345ccef..8807cc5 100644
--- a/gas/atof-generic.c
+++ b/gas/atof-generic.c
@@ -347,11 +347,12 @@ atof_generic (/* return pointer to just AFTER number we read. */
- address_of_generic_floating_point_number->low
+ 1); /* Number of destination littlenums. */
- /* Includes guard bits (two littlenums worth) */
- maximum_useful_digits = (((precision - 2))
- * ( (LITTLENUM_NUMBER_OF_BITS))
- * 1000000 / 3321928)
- + 2; /* 2 :: guard digits. */
+ /* precision includes two littlenums worth of guard bits,
+ so this gives us 10 decimal guard digits here. */
+ maximum_useful_digits = (precision
+ * LITTLENUM_NUMBER_OF_BITS
+ * 1000000 / 3321928
+ + 1); /* round up. */
if (number_of_digits_available > maximum_useful_digits)
{
diff --git a/gas/testsuite/gas/i386/fp.d b/gas/testsuite/gas/i386/fp.d
index a9a9538..edf79ff 100644
--- a/gas/testsuite/gas/i386/fp.d
+++ b/gas/testsuite/gas/i386/fp.d
@@ -4,6 +4,8 @@
.*: file format .*
Contents of section .data:
- 0000 00881bcd 4b789ad4 004071a3 79094f93 ....Kx...@q.y.O.
- 0010 0a40789a 5440789a 54400000 00000000 .@x.T@x.T@......
- 0020 e65e1710 20395e3b e65e1710 20395e3b .\^.. 9\^;.\^.. 9\^;
+ 0000 00881bcd 4b789ad4 004071a3 79094f93 .*
+ 0010 0a40789a 5440789a 54400000 00000000 .*
+ 0020 e65e1710 20395e3b e65e1710 20395e3b .*
+ 0030 00000000 0000a044 01000000 0000a044 .*
+ 0040 00000000 0000f03f .*
diff --git a/gas/testsuite/gas/i386/fp.s b/gas/testsuite/gas/i386/fp.s
index a1f2b0f..11a50cf 100644
--- a/gas/testsuite/gas/i386/fp.s
+++ b/gas/testsuite/gas/i386/fp.s
@@ -15,3 +15,8 @@
# The assembler used to treat the next value as zero instead of 1e-22.
.double .0000000000000000000001
.double 1e-22
+# The assembler used to limit the number of digits too much.
+ .double 37778931862957165903871.0
+ .double 37778931862957165903873.0
+# Ensure we handle a crazy number of digits
+ .double 1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001