Skip to content

migrate: dead statements are not translated; an output that does not check fails (#2781) - #2804

Merged
ehartford merged 1 commit into
std-len-castsfrom
migrate-dead
Oct 29, 2026
Merged

ehartford merged 1 commit into
std-len-castsfrom
migrate-dead

Conversation

@ehartford

@ehartford ehartford commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2781. Battery GREEN on d5154fa.

…nd an output that does not check fails the migration (#2781)

C may keep statements after a return (pocketfft's rfftp_twsize ends
`return t; return 0;`). The structured block lowering translated every
child, so the output had a second return, and With refuses unreachable
code (§20b.5). A statement after a return, break, continue or goto in the
same block never runs; it is skipped until a case, default or label makes
code reachable again (the goto lowering already skipped dead code to the
next label).

`with migrate` analyzed its output for import fix-its and returned 0
whenever no import was missing, so it printed 'error: unreachable code'
about the file it wrote and exited 0. Any error left after the fix-its now
fails the migration with a summary line. No input is known to reach that
path once the dead statements are skipped; it guards the next defect of
this kind.

Test: c-migrator-basic-tests dead_statements (the issue's function and a
case after a break; the output checks).
@ehartford
ehartford added this pull request to stack #2806 October 29, 2026 06:29
@ehartford ehartford changed the title migrate dead migrate: dead statements are not translated; an output that does not check fails (#2781) Oct 29, 2026
@ehartford
ehartford marked this pull request as ready for review October 29, 2026 06:29
@ehartford
ehartford merged commit d20289e into main Oct 29, 2026
@ehartford
ehartford deleted the migrate-dead branch October 29, 2026 06:29
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.

with migrate copies C statements after return, which with check then rejects as unreachable

1 participant