Gibbed.MadMax-1.5.4
Fix: Compiler missing trailing ret 0 sentinel
Bug: The compiler omitted the implicit ret 0 at the end of functions when the last statement was already a return. This caused jz/jmp labels targeting the end of the function to point past the last instruction (out-of-bounds). On subsequent decompilation, the CFG builder couldn't create a block for the invalid target, reducing a 2-successor jz block to 1 successor — which made the decompiler silently drop if guards.
Impact: Any function ending with if ...: return ... (no else) would lose the if condition on round-trip, turning conditional returns into unconditional ones.
Examples from enemy_boarding_gameplay.xvmc:
GetPositionSB— thirdif 1.0 == GetStateBit(char, 22.0): return 22.0became unconditionalreturn 22.0(function now returns22.0even when no state bit is set, instead ofnone)CheckAttackLock—if local2 and local3:guard was dropped, causingGetBlackboardValueFromObjectto be called with a potentially null vehicle reference
Fix: Always emit ret 0 at the end of every function, matching the Avalanche compiler behavior. One line changed in CodeGenerator.cs.