mirror of
https://github.com/radareorg/r2ghidra.git
synced 2026-11-07 06:25:57 -10:00
ccode mode called setNoCastPrinting(true) after applying r2ghidra.casts, so
`e r2ghidra.casts=true` was silently overridden and semantically necessary
truncations disappeared. For
long cast_test(long x) { return (long)(int)x + 0x100000000L; }
the output was `arg1 + 0x100000000`, which evaluates to 0xffffffff at
0xffffffff instead of the 0x1ffffffff the binary produces.
Let r2ghidra.casts decide: ccode keeps only the identifier cleanup and the
hidden implied ZEXT/SEXT extensions and no-convention prototype style. With
ccode=true,casts=true the printer now emits
`(int64_t)(int)arg1 + 0x100000000`; with casts=false it stays cast-free as the
option documents, and ccode=false output is unchanged.
Regression in test/db/extras/r2ghidra_ccode with the compiled fixture.