|
|
| Previous ID |
SR-7354 |
| Radar |
rdar://problem/39209102 |
| Original Reporter |
fabb (JIRA User) |
| Type |
Bug |
| Status |
Resolved |
| Resolution |
Done |
Environment
Xcode 9.3 + iPhone X Simulator 11.3, or iPhone 6 Device 11.3
Additional Detail from JIRA
|
|
| Votes |
3 |
| Component/s |
Compiler |
| Labels |
Bug, 4.1Regression, OptimizedOnly, RunTimeCrash |
| Assignee |
@atrick |
| Priority |
Medium |
md5: 01fbdfe890b85cc4dcce92b1c7fe221d
Issue Description:
Since updating to Xcode 9.3 our project crashes on launch for optimized builds. It happens both on device and simulator, but not necessarily in the same locations. It worked fine with the previous Xcode. It happens for all builds with -O or -Osize optimizations, independent of WMO de/activated, and independent of Swift 3 / Swift 4 mode.
Changing arbitrary things in the method makes it run without crash. Even putting it into a different file might make it not crash anymore.
Example repro code:
// crashes when called on an optimized build (-O or -Osize) both on simulator and device
func crash() {
let blah = ProblematicEnum.problematicCase.problematicMethod()
NSLog("\(blah)")
}
enum ProblematicEnum {
case first, second, problematicCase
func problematicMethod() -> SomeClass {
let someVariable: SomeClass
switch self {
case .first:
someVariable = SomeClass()
case .second:
someVariable = SomeClass()
case .problematicCase:
someVariable = SomeClass(someParameter: NSObject())
_ = NSObject().description
return someVariable // EXC_BAD_ACCESS (simulator: EXC_I386_GPFLT, device: code=1)
}
let _ = [someVariable]
return SomeClass(someParameter: NSObject())
}
}
class SomeClass: NSObject {
override init() {}
init(someParameter: NSObject) {}
}
Example project for convenience: https://github.com/fabb/swift_4_1_crash
Environment
Xcode 9.3 + iPhone X Simulator 11.3, or iPhone 6 Device 11.3
Additional Detail from JIRA
md5: 01fbdfe890b85cc4dcce92b1c7fe221d
Issue Description:
Since updating to Xcode 9.3 our project crashes on launch for optimized builds. It happens both on device and simulator, but not necessarily in the same locations. It worked fine with the previous Xcode. It happens for all builds with
-Oor-Osizeoptimizations, independent of WMO de/activated, and independent of Swift 3 / Swift 4 mode.Changing arbitrary things in the method makes it run without crash. Even putting it into a different file might make it not crash anymore.
Example repro code:
Example project for convenience: https://github.com/fabb/swift_4_1_crash