Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline asm doesn't complain about invalid clobbers #71362

Closed
Vlad-Shcherbina opened this issue Apr 20, 2020 · 1 comment
Closed

Inline asm doesn't complain about invalid clobbers #71362

Vlad-Shcherbina opened this issue Apr 20, 2020 · 1 comment
Labels
A-inline-assembly Area: inline asm!(..) B-unstable Blocker: Implemented in the nightly compiler and unstable. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Vlad-Shcherbina
Copy link

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
@Vlad-Shcherbina Vlad-Shcherbina added the C-bug Category: This is a bug. label Apr 20, 2020
@jonas-schievink jonas-schievink added A-inline-assembly Area: inline asm!(..) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 20, 2020
@nagisa nagisa added the B-unstable Blocker: Implemented in the nightly compiler and unstable. label Apr 20, 2020
@Amanieu
Copy link
Member

Amanieu commented May 22, 2020

This issue does not apply to the new asm! (RFC 2850) which properly validates all register names.

The legacy llvm_asm! is deprecated and is no longer maintained.

@Amanieu Amanieu closed this as completed May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inline-assembly Area: inline asm!(..) B-unstable Blocker: Implemented in the nightly compiler and unstable. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants