Skip to content
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-9103] Runtime Crash in nested type erased protocol wrapper #51600

swift-ci opened this issue Oct 29, 2018 · 2 comments

[SR-9103] Runtime Crash in nested type erased protocol wrapper #51600

swift-ci opened this issue Oct 29, 2018 · 2 comments


Copy link

@swift-ci swift-ci commented Oct 29, 2018

Previous ID SR-9103
Radar rdar://problem/45639109
Original Reporter sebastiangrail (JIRA User)
Type Bug

Attachment: Download


iOS and macOS playground or iPhone 5, iOS 10.3.1 simulator.

All tested on macOS Mojave

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 32BitOnly, RunTimeCrash, Runtime
Assignee None
Priority Medium

md5: 27999312cf902044d5ba3cd6efbc1950

Issue Description:

The following code crashes in swift_retain when run in

  • an iOS or macOS playground

  • iPhone 5, iOS 10.3.1 simulator

I could reproduce the bug on both Xcode 10.0 and Xcode 10.1 beta 2.

public protocol P {
    associatedtype Key
    func f <T> () -> T? where T == Key

public struct AnyP <Key>: P {
    let _f: () -> Key?
    public init <S: P> (_ s: S) where S.Key == Key {
        _f = s.f
    public init (_ f: @escaping () -> Key?) {
        _f = f
    public func f() -> Key? {
        return _f()
let anyP = AnyP<String>( { return nil })
let nestedAnyP = AnyP(anyP)
anyP.f() // This works
nestedAnyP.f() // This crashes

I have attached a sample single view iOS project to reproduce the crash.

Copy link

@belkadan belkadan commented Oct 29, 2018

@swift-ci create

Copy link

@mikeash mikeash commented Nov 8, 2018

Seems to be 32-bit only. Reproduces easily in 32-bit, but no crash in 64-bit.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants