Skip to content

Inline asm doesn't complain about invalid clobbers #71362

Closed
@Vlad-Shcherbina

Description

@Vlad-Shcherbina

To reproduce

Try compiling the following program:

#![feature(asm)]
fn main() {
    unsafe {
        asm!("" : : : "whatever");
    }
}

Expected result

It should fail with an error

unknown register name ‘whatever’ in ‘asm’

Like how gcc and clang do in inline asm in C.

Actual result

It compiles without an error.


Version info:

> rustc --version --verbose
rustc 1.44.0-nightly (52fa23add 2020-04-18)
binary: rustc
commit-hash: 52fa23add6fb0776b32cc591ac928618391bdf41
commit-date: 2020-04-18
host: x86_64-pc-windows-msvc
release: 1.44.0-nightly
LLVM version: 9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inline-assemblyArea: Inline assembly (`asm!(…)`)B-unstableBlocker: Implemented in the nightly compiler and unstable.C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions