Repository navigation
analysis: prune error(nonzero) call fall-through — stop the boundary overrun (closes ~50% of the Ghidra GED gap) - #138
Merged
Conversation
…boundary overrun (close ~50% of the Ghidra GED gap) A 22-case multi-agent investigation of where kuna loses to Ghidra proper found that ~50% (11/22, all the biggest margins) are ONE bug: glibc error(status,…) is conditionally no-return (calls exit() when status != 0), and kuna did not prune the post-call fall-through. So the flow-follower walked past `call error(nonzero)` over the NOP pad into the NEXT function's prologue and decompiled both as one blob — expr/docolon absorbed all of eval6 (561 LOC vs Ghidra's 140); split/bytes_chunk_extract swallowed FIVE functions. Absorbing a foreign CFG maximally inflates node/edge counts -> the catastrophic GED margins. kuna already recognised error(nonzero) (the ErrorRecognizer / noreturn_error, DIV-16) but only committed it FUNCTION-ENTRY-keyed (concludes a wrapper no-return, helps callers). This wires the missing per-CALL-SITE prune, exactly as Ghidra's discovered-no-return analyzer does: - s1_noreturn_propagate collects EVERY `call error(nonzero,…)` site (AnalysisOutput::no_fallthru_calls), - the commit stashes them on Architecture::error_noreturn_callsites, - decompile-all applies them as CALL_RETURN flow overrides (the mechanism was fully ported but nothing fed it). Effect (decompile-all): docolon 561->133 LOC, tr/read_and_delete 374->41, split/bytes_chunk_extract 446->62, nl/build_type_arg 351->35, cat/simple_cat 286->23 — all now Ghidra-like. Pure port-fidelity (no readability trade-off). Gated by the existing noreturn_error + listing, so the datatest/console parity paths (no Listing) are byte-identical. Gates: make test 675/675 PARITY OK, make test-stages 254/254 PARITY OK. New regression test decompile_all_error_nonzero_does_not_absorb_next_function (err_fatal must not absorb compute). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018DV2MXxQAAWK7xLPBmsq9J
This was referenced Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A 22-agent investigation of why kuna loses to Ghidra proper found ~50% (11/22, all the biggest margins) are one bug: glibc
error(status,…)is conditionally no-return (callsexit()whenstatus != 0), and kuna didn't prune the post-call fall-through. So the flow-follower walked pastcall error(nonzero), over the NOP pad, into the next function's prologue and decompiled both as one blob —expr/docolonabsorbed all ofeval6(561 LOC vs Ghidra's 140);split/bytes_chunk_extractswallowed five functions. Absorbing a foreign CFG maximally inflates node/edge counts → the catastrophic GED margins.The wiring gap
kuna already recognised
error(nonzero)(theErrorRecognizer/noreturn_error, DIV-16) but only committed it function-entry-keyed (concludes a wrapper no-return — helps callers). This adds the missing per-call-site prune, exactly as Ghidra's discovered-no-return analyzer does:s1_noreturn_propagatecollects everycall error(nonzero,…)site (AnalysisOutput::no_fallthru_calls),Architecture::error_noreturn_callsites,decompile-allapplies them asCALL_RETURNflow overrides — the mechanism was fully ported but nothing fed it.Effect (decompile-all)
Pure port-fidelity (kuna now does exactly what Ghidra does — no readability trade-off).
Safety
Gated by the existing
noreturn_error+listing, so the datatest/console parity paths (no Listing) are byte-identical.make test675/675 PARITY OK,make test-stages254/254 PARITY OK,make rust-testgreen. New regression testdecompile_all_error_nonzero_does_not_absorb_next_function.🤖 Generated with Claude Code
https://claude.ai/code/session_018DV2MXxQAAWK7xLPBmsq9J