You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading from Xcode 12.4 to 12.5, we discovered that release builds of our app crashed in the function with<T>(elementsAs: ). This is a summary of the class including that function:
public class ChangedObjs<Element> {
public private(set) var added: \[Element\]?
public private(set) var updated: \[Element\]?
public private(set) var toDelete: \[Element\]?
func with\<T\>(elementsAs type: T.Type) -\> ChangedObjs\<T\>? {
let added = self.added as? \[T\]
let updated = self.updated as? \[T\]
let toDelete = self.toDelete as? \[T\]
let isEmpty = \[added, updated, toDelete\]
.compactMap
It's clear in Xcode 12.5, the function is being optimized as inlined in release builds, as the debugger stack trace indicates it as such. In Xcode 12.4, the function also seems to be inlined, although the debugger refuses to step into the function. Debug builds on both versions of Xcode do not inline the function and don't experience the crash, only release builds on Xcode 12.5.
The crash occurs when stepping through the function after the third line:
let toDelete = self.toDelete as? [T]
with the exception:
Thread 34: EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
The text was updated successfully, but these errors were encountered:
I discovered the cause. There's an extra call to .compactMap { $0 } that is redundant. In debug builds and previously in release builds in Xcode 12.4, this just returns the same array. But in release builds in Xcode 12.5 it crashes.
Environment
Xcode 12.5, multiple Macbook computers
Additional Detail from JIRA
md5: eaa39405d59c6739be65f4bf2461e5f1
Issue Description:
After upgrading from Xcode 12.4 to 12.5, we discovered that release builds of our app crashed in the function with<T>(elementsAs: ). This is a summary of the class including that function:
public class ChangedObjs<Element> {
{ $0 }
}
It's clear in Xcode 12.5, the function is being optimized as inlined in release builds, as the debugger stack trace indicates it as such. In Xcode 12.4, the function also seems to be inlined, although the debugger refuses to step into the function. Debug builds on both versions of Xcode do not inline the function and don't experience the crash, only release builds on Xcode 12.5.
The crash occurs when stepping through the function after the third line:
let toDelete = self.toDelete as? [T]
with the exception:
Thread 34: EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
The text was updated successfully, but these errors were encountered: