diff options
author | Alan Modra <amodra@gmail.com> | 2019-11-20 21:54:07 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-11-20 21:59:33 +1030 |
commit | 94c9b9db4b689bc1ae643e053580db1fdfaee2d4 (patch) | |
tree | dd60aaca4cba1d1f152d44055bc7fc13858c4d70 /gas/atof-generic.c | |
parent | e042e6c3e25fd9189001b4c013bed281ac251067 (diff) | |
download | gdb-94c9b9db4b689bc1ae643e053580db1fdfaee2d4.zip gdb-94c9b9db4b689bc1ae643e053580db1fdfaee2d4.tar.gz gdb-94c9b9db4b689bc1ae643e053580db1fdfaee2d4.tar.bz2 |
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.
Diffstat (limited to 'gas/atof-generic.c')
-rw-r--r-- | gas/atof-generic.c | 11 |
1 files changed, 6 insertions, 5 deletions
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) { |