Closed
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).