Skip to content

SILCombine: fix a miscompile in dead alloc_existential_box removal #24835

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 16, 2019

Conversation

eeckstein
Copy link
Contributor

The miscompile results in a use-after-free crash.

rdar://problem/50759056

@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein requested a review from gottesmm May 16, 2019 18:15
Copy link
Contributor

@gottesmm gottesmm left a comment

Choose a reason for hiding this comment

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

Overall looks good to me. Small quibble about making a comment clearer and also an ask for an interpreter test case if we have one.

// CHECK-NEXT: release_value [[T]]
// CHECK-NEXT: tuple
// CHECK-NEXT: return
sil @insert_compensating_release_at_release_of_box : $@convention(method) (@in_guaranteed Array<Error>) -> () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Question. Is there an interpreter test that you can make for this as well? Was there a reduced test case that you had?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I have one. I'll add it.

// is going away so we need to release the stored value.
// Note that it's important that the release is inserted at the single
// release of the box and not at the store, because a balancing retain could
// be _after_ the store, e.g.
Copy link
Contributor

Choose a reason for hiding this comment

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

You should be a colon after this. Also can you make Note in all capital letters? Something like this:

Release the value that was stored into the existential box. The box
is going away, so we need to release the stored value.

NOTE: It is important that the release is inserted at the single release of the box and /not/ at the store since a balancing retain could be after the store, e.g.:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, I'll change it

The miscompile results in a use-after-free crash.

rdar://problem/50759056
@eeckstein
Copy link
Contributor Author

@swift-ci smoke test and merge

1 similar comment
@eeckstein
Copy link
Contributor Author

@swift-ci smoke test and merge

@swift-ci swift-ci merged commit 64ce7b9 into swiftlang:master May 16, 2019
@eeckstein eeckstein deleted the fix-silcombine branch May 17, 2019 02:54
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.

3 participants