avast / avast/retdec

Should output a proper for loop

Open
#390 1 comment 0 reactions 0 assignees View on GitHub
enhancement P-output
Dominant language
C++
Stars
8.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Exe: https://github.com/rfalke/decompiler-subjects/blob/master/from_holdec/dmi/cfg/ia32_elf/subject.exe
Retdec: d57764a

Output:
```
// Address range: 0x80486f0 - 0x804871b
int32_t basic_7_for_loop(void) {
// 0x80486f0
int32_t v1; // bp-12
*(int32_t *)((int32_t)&v1 - 16) = 48;
int32_t v2 = 49; // 0x8048704
putchar(g1);
// branch -> 0x8048700
while (v2 != 58) {
// 0x8048700
*(int32_t *)g2 = v2;
v2++;
putchar(g1);
// continue -> 0x8048700
}
// 0x8048714
g1 = *(int32_t *)(g2 + 24);
return 0;
}
```

Retdec should output a regular for loop.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked subject.exe and reproduce its decompilation using RetDec revision d57764a. Compare the output for basic_7_for_loop with the issue's example, then trace the loop-structure analysis that leaves it as a while loop. Done means the decompiler recognizes and emits a regular for loop for this case.

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.