Skip to content

[6.0] Fix initialization of imported ObjC block types. #73620

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
May 15, 2024

Conversation

atrick
Copy link
Contributor

@atrick atrick commented May 14, 2024

This fixes a SIL ownership verification error when importing structs like:

typedef bool (^boolBlock)(void);

struct objc_bool_block {
__unsafe_unretained boolBlock block;
};

Fixes rdar://126142109 (Found an operand with a value that is not compatible with the operand's operand ownership kind map)

(cherry picked from commit c112e03)

--- CCC ---

Explanation: This fixes a SIL ownership verification error when importing ObjC blocks by making Builtin.zeroInitializer produce an owned SIL value.

Scope: The bug produces invalid SIL, but is unlikely to affect release builds.

Radar/SR Issue: rdar://126142109 (Found an operand with a value that is not compatible with the operand's operand ownership kind map)

main PR: #73577

Risk: Makes it valid in SIL to destroy a zero-initialized value. If that actualy happens, it would be a runtime crash.

Testing: Unit test added.

Reviewer: Egor Zhdan

This fixes a SIL ownership verification error when importing structs like:

typedef bool (^boolBlock)(void);

struct objc_bool_block {
  __unsafe_unretained boolBlock block;
};

Fixes rdar://126142109 (Found an operand with a value that is not compatible
with the operand's operand ownership kind map)

(cherry picked from commit c112e03)
@atrick atrick added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.0 labels May 14, 2024
@atrick atrick requested review from egorzhdan and tbkka May 14, 2024 17:54
@atrick atrick requested a review from a team as a code owner May 14, 2024 17:54
@atrick
Copy link
Contributor Author

atrick commented May 14, 2024

@swift-ci test

@atrick atrick merged commit 4d63543 into swiftlang:release/6.0 May 15, 2024
5 checks passed
@atrick atrick deleted the 6.0-fix-init-objc-block branch May 15, 2024 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants