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-6828] emitting IR SIL function crash #49377

Closed
swift-ci opened this issue Jan 24, 2018 · 7 comments
Closed

[SR-6828] emitting IR SIL function crash #49377

swift-ci opened this issue Jan 24, 2018 · 7 comments
Labels
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

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-6828
Radar rdar://problem/36826848
Original Reporter linqingmo (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Swift Development Snapshot 2018-02-07

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee shajrawi (JIRA)
Priority Medium

md5: ccaacebcd44ad66068cba6d1a4caecd7

Issue Description:

enum Result<Value> {
    case success(Value) // Remove success, no crash
    case failure(Error)
}

struct Response<Value> {
    let data: Data? // Remove data, no crash
    let result: Result<Value>
    init(data: Data?, result: Result<Value>) {
        self.data = data
        self.result = result
    }
}

class ImageDownloader {
    typealias CompletionHandler = (Response<NSObject>) -> Void
//    public typealias CompletionHandler = (Response<Any>) -> Void // No crash
    
    func test() {
        let arr = [CompletionHandler?]()
//        let arr = [CompletionHandler]() // No crash
        let d = arr.index(where: { _ in true })
    }

    func download() {
        let completions: [(receiptID: String, completion: CompletionHandler?)] = []
        for (_, completion) in completions {
            DispatchQueue.main.async {
                completion?(Response(data: nil, result: Result<NSObject>.success(NSObject()))) // Still crashes.
            }
        }
    }
}

These codes crash with error

1. While emitting IR SIL function "@$S11EmmitingBug15ImageDownloaderC4testyyF".

for 'test()'

@belkadan
Copy link
Contributor

With assertions enabled:

> Assertion failed: (args[index]->getType() == IGM.silConv.getSILType(params[index])), function visitPartialApplyInst, file /Volumes/Data/swift-public/swift/lib/IRGen/IRGenSIL.cpp, line 2427.

@swift-ci create

@swift-ci
Copy link
Collaborator Author

Comment by Joe Shajrawi (JIRA)

PR #14187

@swift-ci
Copy link
Collaborator Author

Comment by Joe Shajrawi (JIRA)

commit 02fcdf1

@swift-ci
Copy link
Collaborator Author

Comment by Joe Shajrawi (JIRA)

commit 02fcdf1 on master

@swift-ci
Copy link
Collaborator Author

swift-ci commented Feb 8, 2018

Comment by LinQingmo (JIRA)

func download() {
let completions: [(receiptID: String, completion: CompletionHandler?)] = []
for (_, completion) in completions {
    DispatchQueue.main.async {
        completion?(Response(data: nil, result: Result<NSObject>.success(NSObject()))) // Still crashes.
    }
}
}

Assertion failed: (args[index]->getType() == IGM.silConv.getSILType(params[index])), function visitPartialApplyInst, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/IRGen/IRGenSIL.cpp, line 2415.

@swift-ci
Copy link
Collaborator Author

Comment by Joe Shajrawi (JIRA)

commit 0ca90b8

1 similar comment
@swift-ci
Copy link
Collaborator Author

Comment by Joe Shajrawi (JIRA)

commit 0ca90b8

@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
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
Projects
None yet
Development

No branches or pull requests

3 participants