Repository navigation
fix(type_match): credit arguments for code-only decompilers (fixes wcomment=0) - #28
Merged
Merged
Conversation
…omment=0) Decompilers that emit only C text with no structured `variables` (the LLM backends codex/claude-code, plus dewolf and r2dec) were scored by a regex fallback that (1) parsed only `type name;` declarations — never function- signature ARGUMENTS — and (2) matched by name only. So a function whose only variables are its arguments scored 0 even with perfect argument types, e.g. `bash/O0/mksyntax::wcomment` (`void wcomment(FILE *fp, int c)`): codex recovered both argument types exactly and still got type_match 0.0. Fix: when a decompiled function exposes no structured variables, parse its C — the function signature into arguments (with ABI `arg_index`) plus local declarations — and route through the existing `_match_structured` matcher, so arguments get the same name-independent ABI-position credit every structured decompiler already gets (Pass 1). Bumped cache_version 3 -> 4. Effect (sample-set, shared denominator 229): codex 0 -> 27 perfect, claude-code 0 -> 22 (now ahead of ida 8 / ghidra 12 / angr 13); dewolf and r2dec also rise. The change is monotonic — the denominator is fixed at len(GT vars) and it only adds argument true-positives, so no score can fall. Decompilers exposing real `variables` (angr/ghidra/ida/binja/kuna/phoenix) skip the new path entirely and are unchanged. scripts/refresh_typematch_codeonly.py recomputes type_match for ONLY the four code-only decompilers and merges into the published type_match_new.json overlay, leaving structured decompilers' entries byte-identical (verified). Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1FDD4KNcekjU4LJQHHYbo
mahaloz
added a commit
that referenced
this pull request
Jul 22, 2026
Rebuilds the published site on top of both landed fixes: - type_match now credits arguments for code-only decompilers (#28): codex/ claude-code type_match on the sample-set jump from ~0 to 27/229 and 22/229 perfect (ahead of ida 8 / ghidra 12); dewolf/r2dec also rise. Structured decompilers are unchanged. - the normalize toggle no longer collapses when sample-set-only LLM decompilers are present. No malware source ships in samples.json (is_malware projects excluded). Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1FDD4KNcekjU4LJQHHYbo
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.
Problem
bash/O0/mksyntax::wcomment—void wcomment(FILE *fp, int c)— scored type_match 0.0 for codex despite it recovering both argument types exactly.Root cause: the type_match metric matches structured
variablesin 3 passes, where Pass 1 matches arguments by ABI position (name-independent). But decompilers that emit only C text with no structuredvariables— codex, claude-code, dewolf, r2dec — fell to a regex fallback that (1) parsed onlytype name;declarations, never signature arguments, and (2) matched by name only. A function whose only variables are its arguments therefore scored 0 for all four.Fix
When a decompiled function exposes no structured
variables, parse its C — the signature into arguments (with ABIarg_index) + local declarations — and route through the existing_match_structured. Arguments get the same name-independent position credit every structured decompiler already gets.cache_version3 → 4.Effect (sample-set, shared denominator 229)
Monotonic by construction (denominator fixed at
len(GT vars), only adds argument TPs). Decompilers exposing realvariablesskip the new path and are provably unchanged (overlay entries byte-identical to the pre-change backup).Scope
Only
decbench/metrics/type_match.py+ tests + a recompute helper. Does not touchsite/or the in-flightaggregate.pynormalize fix — the site should be rebuilt after both land.scripts/refresh_typematch_codeonly.pyrefreshes the overlay for only the four code-only decompilers.Tests: added
test_code_parsed_arguments_by_position; 21 type-match tests pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01Y1FDD4KNcekjU4LJQHHYbo