-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RefCell::borrow_mut codegen broken on ARM #40738
Comments
llvm ir for the define void @_ZN9borrowmut7bm_once17h7c1ef392d62ede16E(%"core::cell::RefCell<i32>"* dereferenceable(8)) unnamed_addr #1 personality i32 (i32, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*)* @rust_eh_personality {
entry-block:
%1 = getelementptr inbounds %"core::cell::RefCell<i32>", %"core::cell::RefCell<i32>"* %0, i32 0, i32 0, i32 0, i32 0
%2 = load i32, i32* %1, align 4, !noalias !8
%cond.i.i.i = icmp eq i32 %2, 0
br i1 %cond.i.i.i, label %"_ZN37_$LT$core..cell..RefCell$LT$T$GT$$GT$10borrow_mut17hd3c0713653e53ffbE.exit", label %bb4.i5.i
bb4.i5.i: ; preds = %entry-block
tail call fastcc void @_ZN4core6result13unwrap_failed17hd254683cc02cf089E(), !noalias !13
unreachable
"_ZN37_$LT$core..cell..RefCell$LT$T$GT$$GT$10borrow_mut17hd3c0713653e53ffbE.exit": ; preds = %entry-block
store i32 0, i32* %1, align 4
ret void
} On beta, the last store is different (the store i32 -1, i32* %1, align 4, !noalias !8 |
Looks like it. |
@petrochenkov Seems like the same bug, thanks! Somehow I missed that issue when searching, sorry for dupe. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was trying to compile some programs on my
armv7l
machine and noticed that most programs using regex crate do panic. I've managed to narrow down the issue to aRefCell::borrow_mut
call.Test program:
Versions of Rust tested (installed using rustup, the exact toolchain is
nightly-armv7-unknown-linux-gnueabihf
, etc.):This program works correctly on stable, but on beta and nightly fails with the following backtrace:
What's quite interesting is that the error is not present when cross-compiling from x86-64 to arm.
I've checked the generated assembly, and found a suspicious difference. For this function:
the generated assembly on stable (
rustc -O
) (or when cross-compiling using any version) is:The wrong assembly for beta and nightly differs only by one instruction –
mvneq
instead ofmoveq
.The text was updated successfully, but these errors were encountered: