swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.64k stars 10.38k forks source link

[SR-15169] Crash on generic with Self constrain #57492

Open zienag opened 3 years ago

zienag commented 3 years ago
Previous ID SR-15169
Radar None
Original Reporter @zienag
Type Bug
Environment Apple Swift version 5.4.2 (swiftlang-1205.0.28.2 clang-1205.0.19.57) Target: x86_64-apple-darwin20.6.0 Also tried on latest xcode 13
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 396630b0b1b76c8af572a251a9840e0d

Issue Description:

Code:

protocol Foo {
  associatedtype Subject
  func perform(subject: Subject)
}
struct Bar<T: Foo> where T.Subject == Self {
  func bar(t: T) { t.perform(subject: self) }
}

crash:

<unknown>:0: error: unable to execute command: Illegal instruction: 4
<unknown>:0: error: merge-module command failed due to signal 4 (use -v to see invocation)
typesanitizer commented 3 years ago

Could you specify the exact Xcode version and attach a project which triggers the crash? I tried compiling the single file and it doesn't crash with Xcode 12.5 or Xcode 13 beta 3. Moreover, it looks like the crash is in merge modules, which is a no-op for a module with only one file.