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-10612] Illegal Instruction: 4 when compiling with Xcode 10.2.1 #53012

Closed
swift-ci opened this issue May 3, 2019 · 5 comments · Fixed by #71354
Closed

[SR-10612] Illegal Instruction: 4 when compiling with Xcode 10.2.1 #53012

swift-ci opened this issue May 3, 2019 · 5 comments · Fixed by #71354
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented May 3, 2019

Previous ID SR-10612
Radar None
Original Reporter heath (JIRA User)
Type Bug
Environment

macOS 10.14.4, Xcode 10.2.1

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @slavapestov
Priority Medium

md5: 825e290e69605050e1becb422112fc5f

relates to:

  • SR-8247 Associated type inheriting from generic class with Self as a parameter prints canonical type in errors
  • SR-9301 Error using constrained associated type with generics

Issue Description:

The following code fails to compile on Xcode 10.2.1:

protocol P1: class {
    associatedtype P1P1: P1
    associatedtype P1AnyP2: AnyP2<P1P1>
    
    var anyP2: P1AnyP2? { get set }
}

protocol P2 {
    associatedtype P2P1: P1
}

final class AnyP2<AP2P1: P1>: P2 {
    typealias P2P1 = AP2P1
}

Output:

error: Illegal instruction: 4

Xcode also takes 57 seconds to compile this file, which seems suspect.

Available on GitHub: https://github.com/hborders/SwiftBugs/tree/SR-10612

@belkadan
Copy link
Contributor

belkadan commented May 3, 2019

I don't think this line is supported:

associatedtype P1AnyP2: AnyP2<P1P1>

@slavapestov, @DougGregor, is there a dup of this?

@belkadan
Copy link
Contributor

belkadan commented May 3, 2019

(Of course, "not supported but crashing" is still a bug.)

@slavapestov
Copy link
Member

We class-constrained generic parameters working where the class bound uses other generic parameters, but it looks like the corresponding form with associated types doesn't work. I have a few similar bugs, I'll investigate later to see if they have the same root cause.

@slavapestov
Copy link
Member

No longer crashes on master, and produces a diagnostic about circular references instead. I'll add a regression test.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@slavapestov
Copy link
Member

I forgot when the circular references were fixed but the test case now passes on 5.9 and main.

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants