Navigation Menu

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-12533] Crash while generating SIL witness table protocol conformance #54976

Open
swift-ci opened this issue Apr 6, 2020 · 7 comments
Open
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 regression swift 5.2

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Apr 6, 2020

Previous ID SR-12533
Radar rdar://problem/62201671
Original Reporter Anandabits (JIRA User)
Type Bug

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 5.2Regression, CompilerCrash
Assignee None
Priority Medium

md5: 523995eb08387620fca184c3208ffb78

Issue Description:

The attached sample builds without trouble in Xcode 11.3 / Swift 5.1 but crashes in Xcode 11.4 / Swift 5.2.

If you move the contents of N.swift into main.swift the code compiles in Swift 5.2.

@beccadax
Copy link
Contributor

@swift-ci create

@CodaFi
Copy link
Member

CodaFi commented May 6, 2020

Following the substitutions here and replacing

func b(_ b: T.B) -> B { fatalError() }

By

func b(_ b: (S1.B, S2.B)) -> B { fatalError() }

Appears to work around this. I still do not have a root cause.

@CodaFi
Copy link
Member

CodaFi commented May 6, 2020

It appears the conformance of S1 and S2 to SP is invalid because the type requirement `B` is invalid. Another, independent, workaround

extension S1: SP {
public typealias B = LS<[String: M1], String>

public var b: B { fatalError() }
}
extension S2: SP {
public typealias B = LS<[N.M2], String>

public var b: B { fatalError() }
}

@swift-ci
Copy link
Collaborator Author

swift-ci commented May 6, 2020

Comment by Matthew Johnson (JIRA)

Thank you for the update with a workaround!

@CodaFi
Copy link
Member

CodaFi commented May 6, 2020

`protocol SP: SS` should also not attempt to redeclare the type requirements A, B, and C. That won't buy you anything.

@swift-ci
Copy link
Collaborator Author

swift-ci commented May 6, 2020

Comment by Matthew Johnson (JIRA)

IIRC I have seen the redeclaration improve the compiler's ability to infer associated types. It may be that this was true in the past and is no longer true. I agree that it shouldn't be necessary to redeclare them.

@CodaFi
Copy link
Member

CodaFi commented May 6, 2020

I believe in this case it's actually a cause of the instability. It creates aliases to these type requirements, and when one of those aliases fails then substitutions involving it propagate forward silently. It's possible those aliases are enabling the extensions you have to be picked up, though, in which case it's possible this compiled in 5.1 by accident.

@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
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 regression swift 5.2
Projects
None yet
Development

No branches or pull requests

4 participants