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

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

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

swift-ci opened this issue Oct 29, 2018 · 2 comments
Labels
32 bit only bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software run-time crash Bug → crash: Swift code crashed during execution runtime The Swift Runtime

Comments

@swift-ci
Copy link
Collaborator

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

Attachment: Download

Environment

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.

@belkadan
Copy link
Contributor

@swift-ci create

@mikeash
Copy link
Contributor

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
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
32 bit only bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software run-time crash Bug → crash: Swift code crashed during execution runtime The Swift Runtime
Projects
None yet
Development

No branches or pull requests

4 participants