Skip to content

Fix an issue in the control-flow reconstruction#1066

Open
sonmarcho wants to merge 10 commits intomainfrom
son/cfg
Open

Fix an issue in the control-flow reconstruction#1066
sonmarcho wants to merge 10 commits intomainfrom
son/cfg

Conversation

@sonmarcho
Copy link
Copy Markdown
Member

@sonmarcho sonmarcho commented Mar 16, 2026

Fixes #1051

This PR is AI generated but: I carefully reviewed the code and prompted the AI until I was globally happy with it, before doing the last modifications by hand. I reviewed all the code line by line.

This PR does two things:

  1. improve the heuristics in compute_loop_exits to find better loop exits in the presence of branchings
  2. fix translate_jump by detecting the case problematic in #issue1051 and failing

About 2.: I tried fixing it by inlining the target of the jump instead of introducing a no-op. I think a solution along those lines would make sense, but just inlining probably doesn't work: for instance, I'm not completely sure what happens in case this inlined code ends with, e.g., a break or a continue. As the initial attempt made sense I committed it to keep track of it, but then reverted it. The version I submit in this PR simply fails in the problematic case.

@sonmarcho sonmarcho marked this pull request as ready for review March 16, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: incorrect control-flow reconstruction in the presence of loops

1 participant