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-2623] Swift 3 compiler crashes when a public type calls a rethrowing function declared by a protocol #45228
Comments
The compiler crashes when:
Here is a minimal sample code which reproduces the issue (I could make it crash in an Xcode project): protocol P {
func f(closure: () throws -> Void) rethrows
}
// Segmentation fault: 11
// While running pass #​271294 SILFunctionTransform "Simplify CFG" on SILFunction "@_TFC4GRDB11PublicClass1ffT_T_"
public class PublicClass {
let p: P
init(p: P) {
self.p = p
}
public func f() {
p.f { _ in }
}
}
// No error
class InternalClass {
let p: P
init(p: P) {
self.p = p
}
public func f() {
p.f { _ in }
}
}
// Segmentation fault: 11
// While running pass #​271367 SILFunctionTransform "Simplify CFG" on SILFunction "@_TFV4GRDB12PublicStruct1ffT_T_".
public struct PublicStruct {
let p: P
init(p: P) {
self.p = p
}
public func f() {
p.f { _ in }
}
}
// No error
struct InternalStruct {
let p: P
init(p: P) {
self.p = p
}
public func f() {
p.f { _ in }
}
} |
Looks like we've fixed this in master. @eeckstein, do you know what would have fixed this? |
No. There were no changes in SimplifyCFG which could have fixed this. I'm still investigating... |
Found it. It was fixed by 226e4a7 "Fix a bug related to the opened archetypes tracking" |
Assigning to Roman as he has fixed it. |
Comment by Dan Thorpe (JIRA) Can be re-produced when an internal type has property which adopts the protocol. Not just public. |
danthorpe (JIRA User), can you attach your project, so we can try it against master? |
Comment by Dan Thorpe (JIRA) @belkadan sure, sorry for the delay... Checkout this commit/project: ProcedureKit/ProcedureKit@bf77b7b and then compile the ProcedureKit target for Mac. git clone https://github.com/ProcedureKit/ProcedureKit.git Compiling in Release configuration gives:
The type in question is a generic abstraction to provide many-reads/single-write thread safety, see Protector in Sources/Support.swift Also, this changeset was necessary to get round a Swift 3.0 (Xcode 8.0) release configuration compilation error (doesn't happen in debug configuration) - separate issue which you might be interested in too. |
Comment by Dan Thorpe (JIRA) @belkadan the crash is "fixed" with these changes: ProcedureKit/ProcedureKit@a31ebc3 |
Thanks, Dan. Reopening for now. @swiftix? |
I'm looking into it. When I tried to reproduce with the ToT compiler, I'm running into a different issue. The compiler crashes in the devirtualizer. Seems like this new bug was introduced very recently. |
Environment
Xcode 8 GM Version 8.0 (8A218a), SWIFT_VERSION=3.0
Additional Detail from JIRA
md5: 44aba97a60df66fb84678b64067ecd23
Issue Description:
Hello,
The Swift 3 compiler embedded in Xcode 8 GM Version 8.0 (8A218a) crashes when building the GRDBOSX scheme in Release configuration of https://github.com/groue/GRDB.swift/tree/a8906da890820a0c9090821569c33d411efc9d8f
Steps to reproduce:
1. download the project at https://github.com/groue/GRDB.swift/tree/a8906da890820a0c9090821569c33d411efc9d8f
2. open GRDB.xcworkspace in Xcode
3. build the GRDBOS scheme in the Release configuration
Compiler crashes with Segmentation fault 11 "While running pass #410260 SILFunctionTransform "Simplify CFG" on SILFunction "@TFC4GRDB24FetchedRecordsController12performFetchfT_T"."
I could not build a smaller sample code which exhibits the issue, unfortunately. It looks like the trouble lies in the DatabaseWriter protocol, which crashes the compiler when it is used.
The text was updated successfully, but these errors were encountered: