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 Assembly cause segmentation fault when define label. #14375

Closed
iseki-masaya opened this issue May 23, 2014 · 12 comments
Closed

Inline Assembly cause segmentation fault when define label. #14375

iseki-masaya opened this issue May 23, 2014 · 12 comments
Labels
A-inline-assembly Area: inline asm!(..) C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-macos Operating system: macOS requires-nightly This issue requires a nightly compiler in some way.

Comments

@iseki-masaya
Copy link

OS: OS X 10.8.5
Architecture: x86_64

$ rustc -v
rustc 0.11.0-pre-nightly (6291955 2014-05-19 23:41:20 -0700)
host: x86_64-apple-darwin
fn main() {
    unsafe {
        asm!("label:");
    }
}

This code pass the compiler but cause segmentation fault.
Inline Assembly in LLVM is called at https://github.com/mozilla/rust/blob/master/src/rustllvm/RustWrapper.cpp#l173
The description of module level inline assembly about LLVM is here(http://llvm.org/docs/LangRef.html#module-level-inline-assembly)

@iseki-masaya
Copy link
Author

LLDB says EXC_BAD_ACCESS (code=EXC_I386_GPFLT) and this segmentation fault is not caused on x86_64 linux.

@alexcrichton
Copy link
Member

This appears to have been fixed in more recent versions of LLVM (and the currently bundled one)

@ghost
Copy link

ghost commented Mar 23, 2015

@alexcrichton This doesn't seem to be fixed on OS X, or at least it's happening again. Using labels seems to cause SIGILL or SIGSEGV. Seems to be the same thing noted here.

@alexcrichton
Copy link
Member

Aha I missed the OSX part of this!

@alexcrichton alexcrichton reopened this Mar 23, 2015
@alexcrichton alexcrichton added the O-macos Operating system: macOS label Mar 23, 2015
@steveklabnik
Copy link
Member

Triage: a year and a half later, I'm not sure if this is fixed, as I don't have a mac. We've upgraded LLVM a number of times....

@Mark-Simulacrum
Copy link
Member

Verified as still broken today.

@Mark-Simulacrum
Copy link
Member

Appears to be fixed today... E-needstest.

@Mark-Simulacrum Mark-Simulacrum added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jun 22, 2017
@Mark-Simulacrum Mark-Simulacrum added C-bug Category: This is a bug. and removed E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. labels Jul 21, 2017
@Mark-Simulacrum
Copy link
Member

This isn't actually fixed.

@steveklabnik
Copy link
Member

Triage: don't have a mac, so I can't reproduce, but that doesn't mean that it has been fixed.

@Centril Centril added the requires-nightly This issue requires a nightly compiler in some way. label Oct 25, 2019
@Dylan-DPC-zz
Copy link

I can reproduce this bug. Still exists

@stevecheckoway
Copy link

See #63977 (comment)

@Amanieu
Copy link
Member

Amanieu commented May 23, 2020

You should only use local labels in inline assembly. This is stated in the documentation for the new asm! macro.

@Amanieu Amanieu closed this as completed May 23, 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!(..) C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-macos Operating system: macOS requires-nightly This issue requires a nightly compiler in some way.
Projects
None yet
Development

No branches or pull requests

9 participants