Skip to content

Segmentation fault compiling inline assembly using function address #70596

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

Closed
backup-isaac opened this issue Mar 31, 2020 · 1 comment
Closed
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@backup-isaac
Copy link

Code

This was compiled targeting ARM Cortex-A53 with opt-level=3.

#![feature(asm)]
extern "C" fn foo() {}

fn main() {
  unsafe {
    asm!("mov x0, $0"
      :: "r"(foo)
      :: "volatile");
  }
}

Meta

rustc --version --verbose:

rustc 1.37.0-nightly (0af8e872e 2019-06-30)
binary: rustc
commit-hash: 0af8e872ea5ac77effa59f8d3f8794f12cb8865c
commit-date: 2019-06-30
host: x86_64-unknown-linux-gnu
release: 1.37.0-nightly
LLVM version: 8.0

Error output

Segmentation fault (core dumped)
Backtrace

Even re-running the command I invoked previously with RUST_BACKTRACE=1, the only output I get is

Segmentation fault (core dumped)

@backup-isaac backup-isaac added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 31, 2020
@Centril Centril added P-low Low priority A-inline-assembly Area: Inline assembly (`asm!(…)`) requires-nightly This issue requires a nightly compiler in some way. labels Mar 31, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Apr 3, 2020
@Amanieu
Copy link
Member

Amanieu commented May 8, 2020

Duplicate of #68136. As a workaround you can use foo as usize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority requires-nightly This issue requires a nightly compiler in some way. 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