-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[SR-613] Arc misbehaviour in class-only protocol composition #43230
Comments
@atrick, is this the thing you just fixed? |
I'm afraid this is not something I fixed. In this code: func foo(test: TestRef?) { A function-type value is being returned from test?.testAny without any partial_apply or retain: // function_ref main.TestAny.testAny <A where A: main.TestAny> (A) -> () -> () Then a closure is being created via partial_apply from the function value: // function_ref reabstraction thunk helper from @callee_owned () -> (@unowned ()) to @callee_owned (@in ()) -> (@out ()) That closure is wrapped in an Optional: %16 = enum Then another closure is created bb4(%22 : $@callee_owned (@out (), @in ()) -> ()): // Preds: bb2 Then we release the dead closure which has closed over the test? reference... strong_release %24 : $@callee_owned () -> () // id: %26 It may be that one of these closure/thunk calls is failing to retain the closed-over self. At any rate, when I enable optimization, the dead closure disappears and the crash goes away. |
Comment by Nikita Ilyasov (JIRA) It also can be reproduced like this:
but not like this:
|
Comment by Nikita Ilyasov (JIRA) It can be reproduced in Release build configuration, it's not `NotOptimizedOnly` |
Ah, okay. I guess it was just that particular test case where it got optimized away. Label removed. |
Testing a fix: #2316 |
Fix merged as 461c8e7. |
Environment
Xcode: Version 7.2 (7C68)
Additional Detail from JIRA
md5: df539b1912bca95d03d50bac3b761556
Issue Description:
Object will be deallocated after capturing its function
The text was updated successfully, but these errors were encountered: