[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gas/24944] New: gas doesn't read all necessary ditits when parse a
From: |
jbgg.gnu at gmail dot com |
Subject: |
[Bug gas/24944] New: gas doesn't read all necessary ditits when parse a floating point number |
Date: |
Wed, 28 Aug 2019 18:32:14 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=24944
Bug ID: 24944
Summary: gas doesn't read all necessary ditits when parse a
floating point number
Product: binutils
Version: 2.33 (HEAD)
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gas
Assignee: unassigned at sourceware dot org
Reporter: jbgg.gnu at gmail dot com
Target Milestone: ---
Created attachment 11966
--> https://sourceware.org/bugzilla/attachment.cgi?id=11966&action=edit
Patch for this bug
The pseudo instruction .double doesn't work fine parsing some numbers.
The function atof_generic doesn't read all digits of the number.
POC:
$ cat << EOF | as -o tmp && objdump -s tmp
.data
.double 37778931862957165903873.0
EOF
Output of previous command is:
tmp: file format elf64-x86-64
Contents of section .data:
0000 00000000 0000a044 .......D
We note that number N=37778931862957165903873.0 is calculated with bc with
command:
$echo 'e=75; 2^e + 2^(e-53) + 1' | bc
Then the numbers a=2^75 and b=(1+2^-52)*2^75 are the below and above
approximation of N to a double floating number. The output of previous
command shows that .double instruction chooses 2^75 as double aproximation,
although floating number (1+2^-52)*2^75 is closest to N since N=(a+b)/2 + 1.
This is due to a variable called ``maximum_useful_digits'' which limits the
number of read digits.
We can replace the variable ``maximum_useful_digits'' by the variable
``number_of_digits_available''.
gas/Changelog:
* atof-generic.c: Delete the variable maximum_useful_digits.
* testsuite/gas/i386/fp.s: add numbers where this bugs ocurrs.
* testsuite/gas/i386/fp.d: correct output.
--
You are receiving this mail because:
You are on the CC list for the bug.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug gas/24944] New: gas doesn't read all necessary ditits when parse a floating point number,
jbgg.gnu at gmail dot com <=