Closed
Description
This code:
#![no_std]
#![feature(asm)]
#![feature(start)]
#![feature(lang_items)]
#[lang = "eh_personality"] extern fn eh_personality() {}
#[panic_handler] fn panic(info: &::core::panic::PanicInfo) -> ! { loop {} }
#[start] fn start(_argc: isize, _argv: *const *const u8) -> isize {0}
#[no_mangle] pub fn abort() -> ! { loop {} }
#[no_mangle]
pub fn _start(a: [u32; 6]) {
unsafe {
asm!(""
:: "r{sp}"(a[4]), "r{t0}"(a[5])
: "volatile"
);
}
}
When compiled for the riscv64imac target:
$ cargo rustc --release --target riscv64imac-unknown-none-elf
Ignores the input register constraints which say to use sp
and t0
(defaulting to a0 and a1 instead):
0000000000011000 <_start>:
11000: 01456583 lwu a1,20(a0)
11004: 01056503 lwu a0,16(a0)
11008: 8082 ret
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Inline assembly (`asm!(…)`)Category: This is a bug.Target: RISC-V architectureRelevant to the compiler team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.