Skip to content

Turn mishandled reinitialize-in-defer-after-consume cases into errors. #74154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented Jun 5, 2024

The handling of multi-basic-block control flow in defer blocks looks like it was left incomplete and completely untested; I fixed a few obvious problems but it still completely lacks any analysis of conditional reinitializations. For now, change it to treat attempted reinitializations as uses-after-consumes so we raise reliable errors now instead of emitting code that causes memory corruption at runtime. Fixes rdar://129303198.

…rors.

The handling of multi-basic-block control flow in `defer` blocks looks like it
was left incomplete and completely untested; I fixed a few obvious problems but
it still completely lacks any analysis of conditional reinitializations. For now,
change it to treat attempted reinitializations as uses-after-consumes so we raise
reliable errors now instead of emitting code that causes memory corruption at
runtime. Fixes rdar://129303198.
@jckarter
Copy link
Contributor Author

jckarter commented Jun 5, 2024

@swift-ci Please test

@jckarter
Copy link
Contributor Author

jckarter commented Jun 5, 2024

@swift-ci Please test source compatibility

@jckarter jckarter merged commit efc193f into swiftlang:main Jun 6, 2024
7 checks passed
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