Skip to content

Wrapper for LLVM assertion failures #2975

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
catamorphism opened this issue Jul 20, 2012 · 2 comments
Closed

Wrapper for LLVM assertion failures #2975

catamorphism opened this issue Jul 20, 2012 · 2 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@catamorphism
Copy link
Contributor

It would be great if rustc had a way to print out its own error message on an LLVM assertion failure, along the lines of "this is a bug in the compiler, please report it". Otherwise users may not realize that they're seeing a compiler bug rather than an error in their program.

@bblum
Copy link
Contributor

bblum commented Jul 3, 2013

This would be nonstraightforward: without knowing any LLVM specifics, I'd guess it uses a C assert implementation, which raises SIGABRT. Encapsulating every single call to libllvm that rustc makes would be a huge perf problem, so I expect the best way would be to hack LLVM itself.

@catamorphism
Copy link
Contributor Author

I no longer think this is very important, as we see LLVM assertion failures much less often than we used to. Closing.

RalfJung pushed a commit to RalfJung/rust that referenced this issue Jul 14, 2023
remove compile-flags that are no longer needed

We stopped running fail-tests with optimizations a while ago, so we don't need to explicitly set the opt-level to 0 any more.
jaisnan pushed a commit to jaisnan/rust-dev that referenced this issue Jul 29, 2024
…rust-lang#3221)

Resolves rust-lang#2975

This PR makes Kani able to check if a raw pointer is valid before
casting it to a reference.

To check for the pointer validity when casting it to a reference, inject
asserting `__CPROVER_r_ok(ptr, sz)` into places where a raw pointer is
dereferenced and a reference is immediately taken.

Since this check seems to cause some of the CIs to run out of memory, it
is only enabled under `-Z ptr-to-ref-cast-checks` flag.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.
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-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

2 participants