The following example results in a Segmentation fault: 11 when built with Xcode 9.3 Beta 3, Swift 4.1 and Optimization Level set to -O or -Osize. A sample project can be found here.
import Foundation
import RealmSwift
class Foo: Object {
let bars = LinkingObjects(fromType: Bar.self, property: "foo")
}
class Bar: Object {
@objc dynamic var foo: Foo?
@objc dynamic var string: String?
}
extension Foo {
var crash: Bool {
return Array(bars.filter { $0.string == nil }).isEmpty // --> segmentation fault 11
// return bars.filter { $0.string == nil }.isEmpty --> does not crash
}
}
Environment
Xcode 9.3 beta 3 (9Q117m)Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 1 | |Component/s | Compiler | |Labels | Bug, 4.1Regression, OptimizedOnly | |Assignee | None | |Priority | Medium | md5: 49f01903f0f37bd0f10c2b2bc5e55005Issue Description:
The following example results in a Segmentation fault: 11 when built with Xcode 9.3 Beta 3, Swift 4.1 and Optimization Level set to -O or -Osize. A sample project can be found here.
Crash Log: