avast / avast/retdec

Regression: compare got harder to understand

Open
#796 2 comments 0 reactions 0 assignees View on GitHub
P-output Q-discussion
Dominant language
C++
Stars
8.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Subject: https://github.com/rfalke/decompiler-subjects/tree/master/from_holdec/dmi/exp/ia32_elf/subject.exe

Before
```
int32_t intermediate_2_cmp_with_extra(int32_t a1) {
// 0x8048551
if (a1 <= 19 && a1 > 10) {
```

Now
```
int32_t intermediate_2_cmp_with_extra(int32_t a1) {
if ((uint32_t)(a1 - 11) <= 8) {
```
This "subtract and compare it as unsigned" is a nice implementation trick but decreased the readability.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the output for the linked subject.exe and compare the Before and Now examples in the issue. Trace the decompiler path that emits the unsigned subtract-and-compare form, then determine how the result should be rendered so the original bounds are readable. Done means the generated comparison is clearer without regressing equivalent behavior.

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.