rust-lang / rustc_codegen_cranelift

Cranelift based backend for rustc
Apache License 2.0
1.53k stars 95 forks source link

Bevy crashes at startup on macOS #1507

Open bjorn3 opened 2 weeks ago

bjorn3 commented 2 weeks ago
  1. Build Bevy's breakout example using cg_clif.
  2. Run it.
  3. Crash
Process 4226 stopped
* thread #21, stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
    frame #0: 0x00000001040d3c98 breakout`core::sync::atomic::atomic_load::h64d41284dd085cdc + 112
breakout`core::sync::atomic::atomic_load::h64d41284dd085cdc:
->  0x1040d3c98 <+112>: ldar   x0, [x0]
    0x1040d3c9c <+116>: add    sp, sp, #0x70
    0x1040d3ca0 <+120>: ldp    x29, x30, [sp], #0x10
    0x1040d3ca4 <+124>: ret    
Target 0: (breakout) stopped.
(lldb) bt
* thread #21, stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
  * frame #0: 0x00000001040d3c98 breakout`core::sync::atomic::atomic_load::h64d41284dd085cdc + 112
    frame #1: 0x00000001040d49b8 breakout`std::sys::sync::rwlock::queue::RwLock::lock_contended::ha166ff46bab1cd71 at queue.rs:358:21
    frame #2: 0x00000001040d4ef0 breakout`std::sys::sync::rwlock::queue::RwLock::unlock_queue::h0ea5bb0bc0170131 at lib.rs:1:1
    frame #3: 0x00000001040d5424 breakout`std::sys::sync::rwlock::queue::RwLock::read_unlock_contended::h78e12589d5eef61b + 60
    frame #4: 0x0000000103efaac4 breakout`_$LT$std..sync..rwlock..RwLockReadGuard$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$::drop::h74045886ac3f976a + 196
    frame #5: 0x0000000103ef0e94 breakout`core::sync::atomic::atomic_compare_exchange_weak::h3aaee500ec783651 at atomic.rs:3384:9

The last frame shouldn't be there and the rest of the stack is missing.

cc @janhohenheim

janhohenheim commented 2 weeks ago

Note that this uses Bevy 0.14.0

janhohenheim commented 2 weeks ago

Given this crash, would you rather merge the recommendations now while saying "use cranelift for Linux" or wait until the macOS issues are resolved?