- Factor cod_file_load's parsing into cod_file_load_buf(data, size, name_hint),
which does not take ownership of the buffer; cod_file_load reads the file and
delegates. Lets callers parse objects loaded from an archive (STAGE.DAT) or
other in-memory sources without a temp file. Behavior is unchanged.
- find_procedures collected a procedure entry from every CALL's jump_target (skipping only offset-0 calls), so a CALL whose target lands mid-instruction - a known compiler defect, e.g. QALCALLF's second CALL points inside a CJGT - registered a bogus entry at that address. The phantom boundary truncated the enclosing procedure right after the CALL, dropped the rest of its body, and emitted empty/misattributed procs.
- Skip CALL targets that are not on an instruction boundary (addr_is_instruction), the same condition the emitter uses to recover them as _invalid_target. The trailing instructions now stay in their true procedure.
- Extend call_recovery test: assert no bogus empty proc and that the post-CALL body (SUBSTR/LINK block) stays in the same procedure.
- gen_make_format's extra-mode-byte buffer was uint8_t[8], but a format spec needs ceil((3*fields+1-8)/8) mode bytes - 9 once the operand count reaches 79 (>= 24 fields). With an extended-index destination forcing complex encoding, the write and emit both indexed extra_modes[8+], a stack-buffer-overflow (ASan/UBSan confirmed at codegen_verbs.c:389) whose garbage byte became a phantom mode byte and desynced the operand stream (bogus immediate + spurious BREAK on disassembly).
- Size the buffer for the real maximum: the count byte is a uint8_t, so field_count <= 255 -> total_operands <= 766 -> at most 95 extra mode bytes. Fix the symmetric latent cap in the decoder (mode_bytes[32] -> 96).
- Resolves the desync bytes in ceo_game FGCGHFHT (51 operands, dest RDA201); those offsets now match the shipped object. Add positive test mkfmt_ext_dest_many (extended dest + 26 fields).
- TODO.md: decompiler emits a truncated vars list when DATA contains a
struct overlay (ENPHSTAC), breaking best-effort round-trip; fix is to
size vars from the highest referenced register or the COD data-area
size.
- Compiler/formatter/lexer modifications committed as-is with this batch.