Skip to content

crash: "UNREACHABLE executed at ObjectFile.cpp:52" #743

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
elly opened this issue Jul 26, 2011 · 9 comments
Closed

crash: "UNREACHABLE executed at ObjectFile.cpp:52" #743

elly opened this issue Jul 26, 2011 · 9 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

Comments

@elly
Copy link
Contributor

elly commented Jul 26, 2011

If you accidentally feed rustc --ls a non-object file (as I just did), you get this assertion failure:

Unknown Object File Type
UNREACHABLE executed at ObjectFile.cpp:52!
Aborted (core dumped)

You may also just get a plain segfault. For example, try an empty file :).

@msullivan
Copy link
Contributor

We probably need to sanity check libraries before handing them to llvm. Is there a way to get llvm to do the sanity check without tripping an assert?

@brson
Copy link
Contributor

brson commented Mar 6, 2012

Looks like we should call IdentifyFileType (for which I don't see a C wrapper) before doing whatever we're doing.

@ghost ghost assigned brson Mar 15, 2012
@catamorphism
Copy link
Contributor

An empty file is now handled correctly (error "could not find metadata in empty.") But the original bug still holds (for example, with rustc --ls ~/rust/README.txt

@catamorphism
Copy link
Contributor

Fixing this is blocked on the lack of a binding to LLVM's IdentifyFileType, but I also don't see a Rust library function that gets the size of a file (which is needed because IdentifyFileType takes a length), either. So if someone implements those two things, this should be pretty easy to fix.

@sammykim
Copy link
Contributor

sammykim commented Apr 5, 2013

Is is still problem?
it shows me correct error message
"could not find metadata in /home/sammy.kim/rust/src/README.txt" with rustc --ls ~/rust/src/README.txt

@pcwalton
Copy link
Contributor

I get this when using --ls on an LLVM bitcode file.

@emberian
Copy link
Member

Still broken for LLVM bitcode files, though it is line 57 now.

@bblum
Copy link
Contributor

bblum commented Jul 3, 2013

Not an issue with empty files. Steps to reproduce for llvm bitcode:

rustc --emit-llvm foo.rs
rustc --ls foo.bc

@catamorphism
Copy link
Contributor

This appears to be fixed; rustc --ls foo.bc now prints "could not find metadata in foo.bc". Closing.

keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
Add syscall constants to more Android/Linux targets

Primarily adding `SYS_memfd_create` and `SYS_pivot_root` for `nix`. But I also equalized a few constants across platforms so some of the other ones that were defined on some targets are now defined across all linux/android targets.
marysaka pushed a commit to sunriseos/rust that referenced this issue Oct 20, 2019
pdietl pushed a commit to pdietl/rust that referenced this issue Apr 23, 2020
ZuseZ4 added a commit to EnzymeAD/rust that referenced this issue Mar 7, 2023
* fix ConstantExpr handling in CreateAugmentedPrimal

* add testcase

* fix testcase

* Update constexpr.ll

* respect lifetime

Co-authored-by: Tim Gymnich <[email protected]>
celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Also change rmc-docs tests to use cargo-rmc

All tests already provide a cargo file. For the new example, we use
vector-map crate, so using cargo rmc makes it much easier to check.

Co-authored-by: Adrian Palacios <[email protected]>
tgross35 added a commit to tgross35/rust that referenced this issue Jun 3, 2025
Account for optimization levels other than numbers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

8 participants