x87: fld for 32bit floats get wrong number
- Dominant language
- C++
- Stars
- 8.6k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
Subject: https://github.com/rfalke/decompiler-subjects/blob/master/from_holdec/i386_x87_fpu/ia32_elf/subject.exe
Output:
```
int32_t FLD(void) {
// 0x804a980
printf("FLD(float=12.34...): should= 12.345679/ 1.234568e+01 is=%12f/%15e\n", -5.1234494816610249e+92, -5.1234494816610249e+92);
printf("FLD(double=12.34...): should= 12.345679/ 1.234568e+01 is=%12f/%15e\n", 12.345678901234567, 12.345678901234567);
printf("FLD(long double=12.34...): should= 12.345679/ 1.234568e+01 is=%12f/%15e\n", 12.3457, 12.3457);
return 0;
}
```
The "-5.12344..." should be "12.34...".
Also the float literal in the last line has a suspiciously small amount of digits.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with the linked subject.exe from from_holdec/i386_x87_fpu/ia32_elf and inspect the generated FLD function output. Compare the 32-bit float, double, and long-double lines with the expected 12.345679 values; done means the float line no longer prints the negative value and the long-double literal has the intended precision.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, reverse-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100