Skip to content
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

[6.0] MoveOnlyAddressChecker: More robust checking for consume-during-borrow. #74711

Merged

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented Jun 25, 2024

Explanation: Fixes a compiler crash and properly diagnoses attempts to consume the value of a variable while it's being borrowed, such as if a consume occurs in the case of a borrowing switch on the consumed variable.
Scope: Bug fix.
Issue: rdar:https://124360175.
Original PR: #74707
Risk: Low. Replaces a crash-on-invalid situation with proper diagnostics.
Testing: Swift CI, test cases from bug report(s)
Reviewer: @meg-gupta

- While an opaque borrow access occurs to part of a value, the entire scope of
  the access needs to be treated as a liveness range, so add the `EndAccess`es
  to the liveness range.
- The SIL verifier may crash the compiler on SILGen-generated code when the
  developer's source contains consume-during-borrow code patterns. Allow
  `load_borrow` instructions to be marked `[unchecked]`, which suppresses
  verifier checks until the move checker runs and gets a chance to properly
  diagnose these errors.

Fixes rdar:https://124360175.
@jckarter jckarter requested a review from a team as a code owner June 25, 2024 21:50
@jckarter jckarter changed the title MoveOnlyAddressChecker: More robust checking for consume-during-borrow. [6.0] MoveOnlyAddressChecker: More robust checking for consume-during-borrow. Jun 25, 2024
@jckarter
Copy link
Contributor Author

@swift-ci Please test

@jckarter jckarter merged commit 2e89580 into swiftlang:release/6.0 Jun 26, 2024
5 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.

None yet

2 participants