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-11624] Compiler crashes in SILCombiner::propagateConcreteTypeOfInitExistential(swift::FullApplySite) #54035

Closed
swift-ci opened this issue Oct 17, 2019 · 8 comments
Assignees
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 optimized only Flag: An issue whose reproduction requires optimized compilation protocol compositions Feature → types: protocol composition types SILOptimizer Area → compiler: SIL optimization passes swift 5.1 types Feature: types

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Oct 17, 2019

Previous ID SR-11624
Radar rdar://problem/56373159
Original Reporter wooster (JIRA User)
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

Xcode 11.1 (11A1027)
Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7)

Xcode 11.2 beta 2 (11B44)

Apple Swift version 5.1.1 (swiftlang-1100.0.275.2 clang-1100.0.33.9)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, SILOptimizer, WholeModuleOnly
Assignee @zoecarver
Priority Medium

md5: 60e01b7aaba84d4bacafb1c412c29dd9

is duplicated by:

Issue Description:

The compiler crashes when compiling the reduced case:

class MultiListViewModel<T> {
}

protocol EmptyListViewModel {
}

class Foo<H> {
    init(viewModel: MultiListViewModel<H> & EmptyListViewModel) {
    }
}

final class ItemListViewModel: MultiListViewModel<String> {
}

extension ItemListViewModel: EmptyListViewModel {
}

let item = ItemListViewModel()
let f = Foo(viewModel: item)

with the command:

@swift-ci
Copy link
Collaborator Author

Comment by Andrew Wooster (JIRA)

Any workaround would be extremely helpful.

@theblixguy
Copy link
Collaborator

I think a simple workaround would be to make Foo a struct instead of a class.

@theblixguy
Copy link
Collaborator

cc @gottesmm

@gottesmm
Copy link
Member

@swift-ci create

@swift-ci
Copy link
Collaborator Author

Comment by Andrew Wooster (JIRA)

@theblixguy Thanks, that was helpful. :-)

Since in my case Foo is a UIViewController, the workaround I came up with is to move the problematic parameter out of the init method and into an optional var:

class Foo<H> {
    typealias ViewModel = MultiListViewModel<H> & EmptyListViewModel
    var viewModel: ViewModel?
}

@zoecarver
Copy link
Collaborator

I'd like to take this one.

@zoecarver
Copy link
Collaborator

Forgot to comment earlier. This has been resolved by PR #28012.

@atrick
Copy link
Member

atrick commented Nov 13, 2019

Fix:

commit 4e106fb
Merge: a73c1f4 ddade0a
Author: Andrew Trick <atrick@apple.com>
Date: Fri Nov 1 19:52:42 2019

Merge pull request #28012 from zoecarver/fix/optimizer-and-SR-11624

Fix crash when optimizing protocol composition

@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
@AnthonyLatsis AnthonyLatsis added optimized only Flag: An issue whose reproduction requires optimized compilation protocol compositions Feature → types: protocol composition types types Feature: types swift 5.1 and removed whole module optimization only Flag: An issue whose reproduction requires whole module optimization labels Jan 19, 2024
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 optimized only Flag: An issue whose reproduction requires optimized compilation protocol compositions Feature → types: protocol composition types SILOptimizer Area → compiler: SIL optimization passes swift 5.1 types Feature: types
Projects
None yet
Development

No branches or pull requests

6 participants