Skip to content

Commit

Permalink
Remove implementation for the unreachable intrinsic (#1100)
Browse files Browse the repository at this point in the history
* Remove `unreachable` from intrinsics

* Add test for uses of `unreachable`
  • Loading branch information
adpaco-aws authored Apr 25, 2022
1 parent e988f31 commit ccc1479
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 0 additions & 6 deletions kani-compiler/src/codegen_cprover_gotoc/codegen/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,12 +607,6 @@ impl<'tcx> GotocCtx<'tcx> {
}
"unchecked_sub" => codegen_op_with_overflow_check!(sub_overflow),
"unlikely" => self.codegen_expr_to_place(p, fargs.remove(0)),
"unreachable" => self.codegen_assert(
Expr::bool_false(),
PropertyClass::DefaultAssertion,
"unreachable",
loc,
),
"volatile_copy_memory" => unstable_codegen!(codegen_intrinsic_copy!(Memmove)),
"volatile_copy_nonoverlapping_memory" => {
unstable_codegen!(codegen_intrinsic_copy!(Memcpy))
Expand Down
2 changes: 2 additions & 0 deletions tests/expected/intrinsics/unreachable/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FAILURE\
"unreachable code"
10 changes: 10 additions & 0 deletions tests/expected/intrinsics/unreachable/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
#![feature(core_intrinsics)]

#[kani::proof]
fn main() {
unsafe {
std::intrinsics::unreachable();
}
}

0 comments on commit ccc1479

Please sign in to comment.