-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Can bypass validation of asm! in a function that is never used via inline(always) #36718
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-inline-assemblyArea: Inline assembly (`asm!(…)`)Area: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.Category: This is a bug.F-asm`#![feature(asm)]` (not `llvm_asm`)`#![feature(asm)]` (not `llvm_asm`)P-lowLow priorityLow priorityT-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.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Metadata
Metadata
Assignees
Labels
A-inline-assemblyArea: Inline assembly (`asm!(…)`)Area: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.Category: This is a bug.F-asm`#![feature(asm)]` (not `llvm_asm`)`#![feature(asm)]` (not `llvm_asm`)P-lowLow priorityLow priorityT-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.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Type
Fields
Give feedbackNo fields configured for issues without a type.
STR
NOTE target = x86_64-unknown-linux-gnu in all cases
This is rejected:
But this is accepted:
Don't worry though, because you can't actually use the ARCH specific instruction:
Additional comments
This is a pretty useful bug/feature! You can use it
cargo testthe arch-agnostic parts of a cratedesigned for ARM on x86 without adding a bunch of
cfgattributes:Without the
inline(always)trick, you'll have to add acfg(target_arch = "arm")to thebkptfunction to get this to compile.
I don't think we want people to rely on this though. Specially, if the
inline(always)trick stopsworking in the future.
Meta
cc @brson I'll let you decide how bad this is.