-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Closed
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-inline-assemblyArea: Inline assembly (`asm!(…)`)Area: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
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.
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-inline-assemblyArea: Inline assembly (`asm!(…)`)Area: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.