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-10600] Runtime fails to demangle superclass when superclass's generic constraints are satisified in a conditional conformance #53000

Open
swift-ci opened this issue May 2, 2019 · 3 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 run-time crash Bug → crash: Swift code crashed during execution

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented May 2, 2019

Previous ID SR-10600
Radar rdar://problem/50057445
Original Reporter benpious (JIRA User)
Type Bug

Attachment: Download

Environment

Xcode Version 10.2.1 (10E1001), running on the iOS simulator.

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, RunTimeCrash
Assignee None
Priority Medium

md5: e58a0fb9941799cfe7a5f7a11b213366

relates to:

  • SR-10721 Runtime fails to demangle superclass when a type used to satisfy the superclass's generic bound is used in a superficial way

Issue Description:

Firstly, to address the elephant in the room, I know that this is the exact same error message as a crash that's already a known issue according to the Xcode 10.2 release notes. But based on my conversation with @jckarter on Twitter it's not clear if it's the same crash, hence this ticket.

TL:DR is that if you have a class C<T: P>, class D<T2> conforms to P if T2 conforms to P2, and class C2: C<D>, then C2's superclass metadata will be corrupted somehow.

See the sample project's SwiftTest2.swift file for an implementation of this.

@jckarter
Copy link
Member

jckarter commented May 2, 2019

Thanks for narrowing down the reproducer!

@jckarter
Copy link
Member

Looks like @DougGregor fixed this in the Swift 5.1 runtime in #24759 To backward deploy the fix to Swift 5.0 runtimes in existing OSes, here's a PR that exercises our runtime compatibility hooks: #25030

@swift-ci
Copy link
Collaborator Author

swift-ci commented Jun 6, 2019

Comment by Helge Heß (JIRA)

public protocol Nice {
associatedtype Blub : Nice
var awesomeStuff : Self.Blub { get }
}

struct TestNice : Nice {
var awesomeStuff: some Nice { TestNice() }
}

func call<N: Nice>(for n: N) {
_ = n.awesomeStuff
}

call(for: TestNice()) 

got this one, which produces

2019-06-06 16:09:28.407874+0200 TestDemangle[62667:17535861] failed to demangle witness for associated type 'Blub' in conformance 'TestDemangle.TestNice: Nice' from mangled name '\^A%\^A' 

And @jckarter says might be the same issue. Need to check.

@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 run-time crash Bug → crash: Swift code crashed during execution
Projects
None yet
Development

No branches or pull requests

3 participants