jimc
April 30, 2022, 4:16pm
1
When building an M1 debug build I’m getting the most bizarre crash.
DBG (processor.compressor.getNumBands()); // does not crash
decltype (processor.compressor)* cp{ &processor.compressor };
DBG (cp->getNumBands()); // crashes here
I get a EXC_BAD_ACCESS (code=1, address=0x101d85e30) on the second DBG, which is essentially identical to the first one!?
The two things even have the same memory address in the debugger.
p &processor.compressor
(MultibandDrummondCompressor2<1> *) $0 = 0x0000000143840890
(lldb) p cp
(MultibandDrummondCompressor2<1> *) $1 = 0x0000000143840890
Any clues…
reuk
April 30, 2022, 4:34pm
2
Does it crash with Address Sanitizer enabled?
jimc
April 30, 2022, 4:41pm
3
I didn’t get an address santiizer report when it crashes with it enabled.
jimc
April 30, 2022, 4:50pm
4
Presumably this is the line that crashes.
Why would it load one thing into x8 and then immediately another. What ARM trickery am I missing here?
0x1020b44d0 <+232>: ldr x8, [x0]
-> 0x1020b44d4 <+236>: ldr x8, [x8, #0x18]
reuk
April 30, 2022, 5:06pm
6
Have you tried thread sanitizer?
jimc
April 30, 2022, 5:54pm
7
I’ll give it a whirl. But I don’t think it’s a threading issue, the object being referenced is completely static and constructed on startup…
And the crash is 100% reliable!
edit: Thread Sanitizer says nothing.
jimc
April 30, 2022, 6:15pm
8
Well the difference is I think that the second call is actually a virtual function call, whereas the first call, even in the debug build doesn’t go through the vtable.