-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Closed
Copy link
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-asm`#![feature(asm)]` (not `llvm_asm`)`#![feature(asm)]` (not `llvm_asm`)I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.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.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
Code
The following code segfaults when compiled (rustc asm-avx.rs -C target-cpu=native
)
#![feature(asm)]
use std::alloc;
#[cfg(target_feature = "avx")]
fn main() {
unsafe {
let layout = alloc::Layout::from_size_align_unchecked(32, 32);
let mem = alloc::alloc_zeroed(layout);
asm!(
"vmovdqa ymm0, [{source}]",
source = in(reg) mem,
out("ymm0") _,
);
}
}
Omitting (incorrectly) the register for the inputs and outputs does not cause a segfault.
#![feature(asm)]
use std::alloc;
#[cfg(target_feature = "avx")]
fn main() {
unsafe {
let layout = alloc::Layout::from_size_align_unchecked(32, 32);
let mem = alloc::alloc_zeroed(layout);
asm!(
"vmovdqa ymm0, [{source}]",
source = in(reg) mem,
);
}
}
xmm
registers work fine even when they appear in outputs.
#![feature(asm)]
use std::alloc;
fn main() {
unsafe {
let layout = alloc::Layout::from_size_align_unchecked(16, 16);
let mem = alloc::alloc_zeroed(layout);
asm!(
"movdqa xmm0, [{source}]",
source = in(reg) mem,
out("xmm0") _,
);
}
}
Meta
rustc --version --verbose
:
rustc 1.47.0-nightly (8ad7bc3f4 2020-07-21)
binary: rustc
commit-hash: 8ad7bc3f428300aee6764f6e23527e19eb235e81
commit-date: 2020-07-21
host: x86_64-apple-darwin
release: 1.47.0-nightly
LLVM version: 10.0
Error output
There is no output, rustc
segfaults before emitting any.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-asm`#![feature(asm)]` (not `llvm_asm`)`#![feature(asm)]` (not `llvm_asm`)I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.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.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.