Decompiled C code needs tests to fix real errors after recompiling
Recompilation Is Not Enough: Test-Guided Decompiled-C Repair
Software EngineeringArtificial Intelligence
Summary
When computer programs written in C are turned back from machine code into source code, they often need fixing before they can be turned back into working programs. Just being able to recompile the fixed code does not guarantee the program behaves the same as before. The authors show that using tests based on what the program should do helps find and fix these hidden problems. By combining compiler feedback and test results, most programs can be repaired to behave correctly again. This method is more reliable than only checking if the code compiles.
decompiled codeC programming languagerecompilationcompiler diagnosticsprogram testingbehavioral correctnesssmoke testslinkerLLM-assisted repairsemantic repair
Authors
Yuhan Huang, Puzhuo Liu, Jianlei Chi
Abstract
Decompiled C often becomes recompilable only after repair, but recompilation alone does not establish test-observed behavior. A recompiled command-line binary can still parse options incorrectly, print different bytes, or return a different exit status. We present a few-step workflow for repairing decompiled C using compiler feedback and related official tests. Compiler and linker diagnostics first guide build repair. Once the repaired C recompiles into a binary, smoke checks and related official tests expose behavioral discrepancies for semantic repair. In a preliminary static-enriched evaluation on 104 Coreutils 9.5 binaries with available decompiler exports and deterministic exact-output smoke comparisons, 91 binaries (87.5%) recompile and pass the test gate; 9 do not recompile within the repair budget, and 4 recompile but still fail the test gate. The result suggests that test-gate feedback can make LLM-assisted repair of decompiled C more auditable than compile-only recovery.