-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Open
Labels
A-inline-assemblyArea: Inline assembly (`asm!(…)`)Area: Inline assembly (`asm!(…)`)A-nakedArea: `#[naked]`, prologue and epilogue-free, functions, https://git.io/vAzzSArea: `#[naked]`, prologue and epilogue-free, functions, https://git.io/vAzzSC-bugCategory: This is a bug.Category: This is a bug.F-naked_functions`#![feature(naked_functions)]``#![feature(naked_functions)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
I tried this code:
extern "C" fn foo() {
unsafe {
core::arch::asm!("mov rax, QWORD PTR gs:[60h]");
}
}
#[unsafe(naked)]
extern "C" fn foo2() {
core::arch::naked_asm!("mov rax, QWORD PTR gs:[60h]")
}
I expected to see this happen: Both functions assemble correctly, as the only difference between the assembly statements is naked_asm!
being used instead of asm!
.
Instead, this happened: Assembly error in foo2
:
error: <inline asm>:10:27: unknown token in expression
mov rax, QWORD PTR gs:[60h]
^
Meta
rustc --version --verbose
:
rustc 1.92.0-nightly (4645a7988 2025-09-17)
binary: rustc
commit-hash: 4645a7988177c286f61609cc667ecae4c571a2e8
commit-date: 2025-09-17
host: x86_64-pc-windows-msvc
release: 1.92.0-nightly
LLVM version: 21.1.1
Metadata
Metadata
Assignees
Labels
A-inline-assemblyArea: Inline assembly (`asm!(…)`)Area: Inline assembly (`asm!(…)`)A-nakedArea: `#[naked]`, prologue and epilogue-free, functions, https://git.io/vAzzSArea: `#[naked]`, prologue and epilogue-free, functions, https://git.io/vAzzSC-bugCategory: This is a bug.Category: This is a bug.F-naked_functions`#![feature(naked_functions)]``#![feature(naked_functions)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.