avast / avast/retdec

x87: incorrect implementation of fprem1

Open
#887 0 comments 0 reactions 0 assignees View on GitHub
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 FPREM(int32_t a1) {
// 0x804ab70
printf("FPREM(11 mod 7): should= 4.000000/ 4.000000e+00 is=%12f/%15e\n", 4.0, 4.0);
printf("FPREM1(11 mod 7): should= -3.000000/ -3.000000e+00 is=%12f/%15e\n", 4.0, 4.0);
...
```

There are cases where the semantic of fprem and fprem1 differs. Like in the above case.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked i386_x87_fpu/ia32_elf/subject.exe case and reproduce the FPREM/FPREM1 output shown in the issue. Trace the decompiler's x87 handling for FPREM1 and compare its result with the documented distinction, considering the work done when FPREM1(11 mod 7) reports -3.000000 rather than 4.000000.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.