Skip to content

Recognize no-local TP6 epilogues and preserve hidden static-link evidence - #2

Merged
janrysavy merged 4 commits into
mainfrom
review/tp6-no-local-frames-20260925
Sep 25, 2026
Merged

janrysavy merged 4 commits into
mainfrom
review/tp6-no-local-frames-20260925

Conversation

@janrysavy

Copy link
Copy Markdown
Owner

Reproduced defect

A real Turbo Pascal 6 nested procedure with no local allocation ends in pop bp; ret 6, without mov sp,bp. analyse_frame recognized only the longer epilogue and lost the return discipline, popped-byte count, and unread static-link slot.

Fix

Recognize the short epilogue only when no nonzero local allocation was observed. Allocated frames still require the observed SP reset. Preserve the BP-frame and POP BP checks. Correct the explanatory RET 4 comment: four bytes are two words, not one; caller-owned string-result buffers can account for reads beyond the popped area.

Verification

New regression file: 6 failures / 5 passes before the fix; all 11 pass after. Full local Python 3.13 suite: 197 passed, 36 skipped. The same suite passed on GitHub while publishing the code. Fresh PR CI will check this final head, which contains no temporary review workflows.

Controls cover near/far returns, zero/nonzero local allocation, the unread nested static link, missing BP setup, wrong POP, and absent POP. Only source and generic instruction-byte tests are included.

@janrysavy
janrysavy merged commit a73cf05 into main Sep 25, 2026
1 check passed
@github-actions
github-actions Bot deleted the review/tp6-no-local-frames-20260925 branch September 25, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant