Closed
Description
This example fails w/an assertion error:
rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h:169: unsigned int llvm::FunctionLoweringInfo::InitializeRegForValue(const llvm::Value*): Assertion `R == 0 && "Already initialized this value register!"' failed.
Aborted (core dumped)
Source:
#![feature(asm)]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
fn get_timer() -> i32 {
let tsc: i32;
unsafe {
asm!("nop": "=a"(tsc));
}
tsc
}
fn main() {
println!("Val: {}", get_timer());
}
Correcting the "=a"(tsc)
to be "=A"(tsc)
makes the assertion error go away.