-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Runtime crash "outlined init with take of any ..." #61403
Comments
|
I'm able to reproduce as well: Looks like |
|
/cc @slavapestov |
|
This looks like a backward deployment scenario, so the Swift runtime cannot demangle a constrained existential type. We shouldn't be using the mangling in this case. |
|
Cannot reproduce on |
|
@AnthonyLatsis You have to use an old OS and link against the OS runtime not the just-built runtime. |
|
I see. But why is the demangler not hit with optimizations disabled? The inlined |
|
Yeah, maybe it's been fixed on main but I was not compiling with any back-deployment setup, just the vanilla |
|
Running on any OS that does not have the new runtime support for constrained existential types is a backward deployment scenario.
Note that you don't necessarily have to be using an old OS - using the current macOS 12 is also considered "back deployment" here. |
|
Is there any easy temporary workaround except building without optimization? Even if need some more boilerplate code. |
|
Try changing the stored property to have an unconstrained existential type, and add a computed property that does a downcast: private let _delegate: any Delegate
private var delegate: any Delegate<T> {
return _delegate as! any Delegate<T>
} |
|
@slavapestov - the above requires to have min deployment target of macOS 13.0 or iOS 16.0 in order to compile which is not an option in my case. However if I disable the optimizations only for the @_optimize(none)
init(delegate: any Delegate<T>) {
self.delegate = delegate
}It is not the best I guess but at least does not require to disable the optimizations for the whole app. |
|
Looks like it still reproduces in Xcode 14.1 (Swift 5.7.1) |
|
I believe this was fixed by #61646 |
|
Still reproduces on Xcode 14.2 RC (14C18). |
|
It is fixed on the main branch (5.8), but most likely will not make it into a 5.7 patch release; not to be expected anyway. |
|
@AnthonyLatsis Could you, please, tell, when to expect 5.8? |
|
You can get a rough idea from looking at the dates of previous releases in this repo. I can only guess myself. I trust you understand the odds of someone disclosing the schedule are next to zero, even if known. |
|
The same change appears on the release/5.7 branch as 1145332, so maybe it will appear in a subsequent 5.7 patch release? Or perhaps it did not fix the issue, if Xcode 14.2 RC includes that change. |
|
I believe the fix is included in Xcode 14.2 RC (14C18). @aschwaighofer is this test case different from the one you fixed? |
|
tested on the released xcode 14.2 |
|
I can also confirm no crash on iOS 15.5 Simulator using Xcode 14.2 (14C18). But I added the following code and have a warning in the console. Not sure if that's expected or not: ...
let a = A(delegate: ConcreteClass())
dump(a)
|
Describe the bug
Crash in Release mode or if
Optimization LevelofSwift Compiler - Code GenerationisOptimize for Speed [-O]. It works as expected in Debug mode.Steps To Reproduce
Expected behavior
The code runs fine without any crashes when is Optimised for speed
Screenshots
[Attached screenshot with the crash] https://i.stack.imgur.com/SgVUk.png
Environment (please fill out the following information)
The text was updated successfully, but these errors were encountered: