PR24944, gas doesn't read enough digits when parsing a floating point number

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.
This commit is contained in:
Alan Modra 2019-11-20 21:54:07 +10:30
parent e042e6c3e2
commit 94c9b9db4b
4 changed files with 23 additions and 8 deletions

View File

@ -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.

View File

@ -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)
{

View File

@ -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 .*

View File

@ -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