avast / avast/retdec

x87: missing code for fcom and ftst

Open
#882 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 FCOM(int32_t a1) {
// 0x804a2f0
__asm_wait();
int32_t v1; // 0x804a2f0
int32_t v2 = v1 & 0x4500; // 0x804a2fc
printf("FCOM(1,para): should=0x0000 is=0x%04x\n", v2);
__asm_wait();
printf("FCOM(para,1): should=0x0100 is=0x%04x\n", v2);
__asm_wait();
printf("FCOM(pi,1): should=0x0000 is=0x%04x\n", v2);
__asm_wait();
printf("FCOM(1,pi): should=0x0100 is=0x%04x\n", v2);
...
```

The value v2 should change for each printf call. Something is missing here.

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect the linked subject.exe and its generated FCOM output, focusing on the FCOM and FTST cases shown in the issue. Compare the emitted code with the expected status values for each printf call. Done means the generated output preserves the differing x87 comparison results instead of reusing an unchanged v2.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.