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

llvm error: cfi: Assertion 'isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed #111216

Closed
matthiaskrgr opened this issue May 4, 2023 · 3 comments
Assignees
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. PG-exploit-mitigations Project group: Exploit mitigations

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented May 4, 2023

I tried this code:
rustc treereduce.out -Clto -Zsanitizer=cfi -Copt-level=1 -Cdebuginfo=2 --crate-type lib

pub fn main() {
    std::process::Command::new("");
}

I expected to see this happen: explanation

Instead, this happened: explanation

Meta

rustc --version --verbose:

eac35583d2ffb5ed9e564dee0822c9a244058ee0
Backtrace

rustc: /home/matthias/vcs/github/rust_debug_assertions/src/llvm-project/llvm/include/llvm/Support/Casting.h:579: decltype(auto) llvm::cast(From *) [To = llvm::MDNode, From = llvm::Metadata]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
[2]    3933595 IOT instruction  RUSTFLAGS="" ~/.rustup/toolchains/local-debug-assertions/bin/rustc  -Clto

@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. labels May 4, 2023
@matthiaskrgr matthiaskrgr changed the title llvm error: cfi: Assertion isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed` llvm error: cfi: Assertion 'isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed May 4, 2023
@matthiaskrgr
Copy link
Member Author

another one:

pub enum MaybeOwned<'a> {
    Borrowed(&'a isize),
}

pub struct Inv<'a> {
    x: &'a mut &'a isize,
}

pub trait IntoMaybeOwned<'a> {
    fn into_maybe_owned(self) -> MaybeOwned<'a>;
}

impl<'a> IntoMaybeOwned<'a> for Inv<'a> {
    fn into_maybe_owned(self) -> MaybeOwned<'a> {
        panic!()
    }
}

@matthiaskrgr matthiaskrgr added the PG-exploit-mitigations Project group: Exploit mitigations label May 13, 2023
@rcvalle
Copy link
Member

rcvalle commented Jul 18, 2023

@rustbot claim

@rcvalle
Copy link
Member

rcvalle commented Aug 9, 2023

This seems to have been fixed in #113593.

@rcvalle rcvalle closed this as completed Aug 9, 2023
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. C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. PG-exploit-mitigations Project group: Exploit mitigations
Projects
None yet
Development

No branches or pull requests

2 participants