Repository navigation
migrate: dead statements are not translated; an output that does not check fails (#2781) - #2804
Merged
Merged
Conversation
…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
marked this pull request as ready for review
October 29, 2026 06:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2781. Battery GREEN on d5154fa.