Skip to content

MoveOnlyAddressChecker: More robust checking for consume-during-borrow. #74707

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

Merged
merged 1 commit into from
Jun 26, 2024

Conversation

jckarter
Copy link
Contributor

  • 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 EndAccesses 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://124360175.

- 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://124360175.
@jckarter jckarter requested a review from kavon as a code owner June 25, 2024 21:23
@jckarter
Copy link
Contributor Author

@swift-ci Please test

Copy link
Contributor

@meg-gupta meg-gupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a minor comment. Other than that LGTM!

@jckarter jckarter merged commit 636a19d into swiftlang:main 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.

2 participants