Closed
Description
Nightly rustc correctly handles the first of these two inline assembly statements but silently does the wrong thing with the second one (example on Compiler Explorer).
#![feature(asm)]
static FOO: usize = 0;
pub unsafe fn example() {
asm!("movq $0, %rax" :: "i"(&FOO) :: "volatile");
asm!("mov rbx, $0" :: "i"(&FOO) :: "intel", "volatile");
}
The issue is LLVM's call asm inteldialect
had a bug that was fixed. I think the solution is to cherry-pick the LLVM fix.
You can see the problem directly using LLVM IR here.