Description
Recent rustc seems to miscompile something somewhere in the dependency tree of Bevy, causing apps to crash with a segfault.
The issue seems to only manifest when optimizations are enabled and codegen units are > 1. The default cargo release configuration triggers it. Unoptimized builds are fine. Setting codegen-units = 1
with opt-level = 3
also seems to be fine.
I am on macOS 14.1 Sonoma, on Apple M1 Pro hardware.
Code
You can reproduce with any Bevy application. It is a huge code base, I know, I'm sorry I can't find a more minimal example.
Clone the Bevy repo: https://github.com/bevyengine/bevy
all these revs have the issue:
- commit bf4f4e42da3da07b0e84a4d6e40077f7398aea8b (i had that one laying around)
- commit 749f3d74305d35b4a453a80e45b22f08d5189a48 (current latest)
- tag v0.12.0
- tag v0.11.3
Run some example in release mode:
cargo run --example bevymark --release
Version it worked on
The previous 1.74.0-beta.7 did not have the issue. I am not sure which nightly introduced the regression.
Version with regression
I first noticed the issue when I installed the 2023-11-11 nightly, though it might also be present in earlier nightlies. I just installed 1.75.0-beta.1 and updated my nightly, and can confirm the issue is present there, too.
rustc 1.75.0-beta.1 (782883f60 2023-11-12)
binary: rustc
commit-hash: 782883f609713fe9617ba64d90086742ec62d374
commit-date: 2023-11-12
host: aarch64-apple-darwin
release: 1.75.0-beta.1
LLVM version: 17.0.4
rustc 1.76.0-nightly (ba7c7a301 2023-11-13)
binary: rustc
commit-hash: ba7c7a301984967c8c13adb580ef9b86ba706a83
commit-date: 2023-11-13
host: aarch64-apple-darwin
release: 1.76.0-nightly
LLVM version: 17.0.4