Skip to content

[cast-optimizer] Fix a leak in the cast optimizer when we perform loa… #25470

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

gottesmm
Copy link
Contributor

…d promotion and fail.

Specifically, in this part of the cast optimizer we are trying to optimize casts
that can be done in two parts. As an example consider: NSObject ->
Array. In this case, we first cast from NSObject -> NSArray and then try to
conditionally bridge to Array from NSArray.

The problem is we did not destroy the NSObject correctly if the first cast
failed. I couldn't figure out how to create an actual swift test case that
produces this problem since we are pretty conservative about triggering this
code path. But in SIL it is pretty easy and in ossa, we trigger the ownership
verifier.

This is another victory for the ownership verifier!

rdar://51753580

…d promotion and fail.

Specifically, in this part of the cast optimizer we are trying to optimize casts
that can be done in two parts. As an example consider: NSObject ->
Array<Any>. In this case, we first cast from NSObject -> NSArray and then try to
conditionally bridge to Array<Any> from NSArray.

The problem is we did not destroy the NSObject correctly if the first cast
failed. I couldn't figure out how to create an actual swift test case that
produces this problem since we are pretty conservative about triggering this
code path. But in SIL it is pretty easy and in ossa, we trigger the ownership
verifier.

This is another victory for the ownership verifier!

rdar://51753580
@gottesmm gottesmm requested a review from aschwaighofer June 14, 2019 17:35
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

Copy link
Contributor

@aschwaighofer aschwaighofer left a comment

Choose a reason for hiding this comment

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

lgtm

@gottesmm gottesmm merged commit b6b0056 into swiftlang:master Jun 14, 2019
@gottesmm gottesmm deleted the pr-6fcc994438ac76ad7a3daeb6e8993047694b2524 branch June 14, 2019 23:21
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