From 8a9ab7c95e6ed898404db8fc5c9bca2a97196ab5 Mon Sep 17 00:00:00 2001 From: Cathal Mullan Date: Sat, 28 Feb 2026 19:33:23 +0000 Subject: [PATCH] Fix inline asm register allocator corrupting `rbx` --- src/inline_asm.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/inline_asm.rs b/src/inline_asm.rs index ac0da06cbb..d6a3ae1df7 100644 --- a/src/inline_asm.rs +++ b/src/inline_asm.rs @@ -249,6 +249,12 @@ impl<'tcx> InlineAssemblyGenerator<'_, 'tcx> { let mut allocated = FxHashMap::<_, (bool, bool)>::default(); let mut regs = vec![None; self.operands.len()]; + // `rbx` is used by the asm wrapper. + // Mark `bx` as in-use so the allocator won't corrupt it. + if self.arch == InlineAsmArch::X86_64 { + allocated.insert(InlineAsmReg::X86(X86InlineAsmReg::bx), (true, true)); + } + // Add explicit registers to the allocated set. for (i, operand) in self.operands.iter().enumerate() { match *operand {