-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-inline-assemblyArea: Inline assembly (`asm!(…)`)Area: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.Category: This is a bug.F-asm`#![feature(asm)]` (not `llvm_asm`)`#![feature(asm)]` (not `llvm_asm`)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.
Description
#![feature(asm)]
#[no_mangle]
pub fn aaaaaaaaaaaaaaaaaa(x: &mut u32) {
unsafe { asm!("lock"); }
*x += 1;
}
This is not rejected, and, according to objdump, results in the following assembly (when optimizations are on):
0000000000000000 <aaaaaaaaaaaaaaaaaa>:
0: 48 83 ec 08 sub $0x8,%rsp
4: f0 83 07 01 lock addl $0x1,(%rdi)
8: 58 pop %rax
9: c3 ret
I'd expect this to result in an error, since lock
by itself isn't a valid instruction (it doesn't really seem desirable to let asm!()
affect how rustc-produced instructions are decoded).
Metadata
Metadata
Assignees
Labels
A-inline-assemblyArea: Inline assembly (`asm!(…)`)Area: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.Category: This is a bug.F-asm`#![feature(asm)]` (not `llvm_asm`)`#![feature(asm)]` (not `llvm_asm`)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.