avast / avast/retdec

x87: strange code/confusion for fcomi, fptan and fsincos

Open
#883 2 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 FCOMI(int32_t a1) {
...
int3_t v9; // 0x804a410
int3_t v10 = v9 - 1; // 0x804a47b
__frontend_reg_store_fpr(v10, __frontend_reg_load_fpr(v10));
printf("FCOMI(1,pi): should=0x01 is=0x%02x\n", 1);
...
```

No idea what triggers these __frontend_reg* calls but it creates noise in the output.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the referenced i386_x87_fpu subject.exe and inspect the generated output around FCOMI, fptan, fsincos, and the __frontend_reg_store_fpr/__frontend_reg_load_fpr calls. Determine why these calls appear as noise, then verify that the expected FCOMI output remains correct without the unnecessary code.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.