Crash without stack trace in optimized builds on device (Xcode 16)

Hi,

I'm looking for some advise how to narrow down the location of the crash.

When I run the app with Debug configuration (GCC_OPTIMIZATION_LEVEL=0) everything just works. But in Release configuration with -Os the app crashes. Also need to mention that the crash happens on the device only, but not on the simulator. When the crash happens, there's no stack trace available. The crash happens every time, a couple seconds after I see the first screen. Currently I'm using Xcode Version 16.0 (16A242d), but I have also tried all combinations of:

  • Xcode 16.1 Beta 1
  • Xcode 16.1 Beta 2
  • Device with iOS 18
  • Device with iOS 17.7
  • Device with iOS 17.6.1

The result is always the same.

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=257, address=0x100000002)
  * frame #0: 0x0000000100000002

Is there anything I can do to further narrow down the location of the crash?

Here's a full crash report that I got from the device: https://gist.github.com/plu/e9ed984f438358b5fbf120148cbbaef0

Maybe there's a bug in the optimizer. But I think it is more likely that your code is doing something wrong, and sometimes getting away with it. Try turning on the memory management diagnostics in the Scheme editor and run your debug version again.

Crash without stack trace in optimized builds on device (Xcode 16)
 
 
Q