Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Implement "unreachable" intrinsic #1254

Closed
RalfJung opened this issue Mar 23, 2020 · 0 comments · Fixed by #1260
Closed

Implement "unreachable" intrinsic #1254

RalfJung opened this issue Mar 23, 2020 · 0 comments · Fixed by #1260
Labels
A-shims Area: This affects the external function shims C-bug Category: This is a bug. I-misses-UB Impact: makes Miri miss UB, i.e., a false negative (with default settings)

Comments

@RalfJung
Copy link
Member

RalfJung commented Mar 23, 2020

This program currently errors in the wrong way:

fn main() {
    unsafe { std::hint::unreachable_unchecked() }
}

says

error: unsupported operation: unimplemented (diverging) intrinsic: unreachable
  --> /playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/hint.rs:51:5
   |
51 |     intrinsics::unreachable()
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ unimplemented (diverging) intrinsic: unreachable
   |
   = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support

The "likely not a bug" part is definitely wrong.

An implementation might land in rustc with rust-lang/rust#70324, which we'd just inherit -- so action should only be taken in Miri if that PR does not go anywhere.

@RalfJung RalfJung added A-shims Area: This affects the external function shims I-misses-UB Impact: makes Miri miss UB, i.e., a false negative (with default settings) C-bug Category: This is a bug. labels Mar 23, 2020
@bors bors closed this as completed in a84d8a8 Mar 25, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-shims Area: This affects the external function shims C-bug Category: This is a bug. I-misses-UB Impact: makes Miri miss UB, i.e., a false negative (with default settings)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant