Skip to content

rustc SIGSEGV compiling for thumbv7em with bad asm #53065

Closed
@mqudsi

Description

@mqudsi
mqudsi@Blitzkrieg /m/d/G/r/fullbuild> rustc --version
rustc 1.30.0-nightly (7e8ca9f8b 2018-08-03)
mqudsi@Blitzkrieg /m/d/G/r/fullbuild> rustc --target thumbv7em-none-eabi ./test.rs
fish: Job 2, “rustc --target thumbv7em-none-e…” terminated by signal SIGSEGV (Address boundary error)

test.rs:

#![feature(lang_items, start, asm)]
#![feature(panic_implementation)]
#![no_std]

use core::panic::PanicInfo;

fn rotr32(value: u32, mut shift: u8) -> u32 {
    shift = shift & 31;
    let result: u32;
    unsafe {
    asm!("ror $0, $1"
         : "=r"(result)
         : "r,0"(value), "r"(shift)
         );
    }

    return result;
}

#[start]
fn main(_argc: isize, _argv: *const *const u8) -> isize {
    return rotr32(14, 1) as isize;
}

#[panic_implementation]
fn panic(_: &PanicInfo) -> ! {
    loop {}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-inline-assemblyArea: Inline assembly (`asm!(…)`)O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 staterequires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions