Repository navigation
Support the abort_immediate intrinsic - #5037
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The narrow change preserves existing abort semantics and adds regression coverage for both verification outcomes.
No open issues 🎉
What changed in this PR
Adds abort_immediate support to Kani’s GotoC backend, treating it as a failed assertion like abort and resolving #5036.
Changes:
- Reuses existing abort handling for the renamed intrinsic.
- Adds regression tests for ordinary and
should_panicharnesses. - Documents intrinsic support.
| File | Description |
|---|---|
| tests/kani/Intrinsics/NonRet/abort_immediate.rs | Tests expected verification failure. |
| tests/kani/Intrinsics/NonRet/abort_immediate_should_panic.rs | Tests successful panic-like handling. |
| kani-compiler/src/codegen_cprover_gotoc/codegen/intrinsic.rs | Handles both abort intrinsic names. |
| docs/src/rust-feature-support/intrinsics.md | Lists abort_immediate as supported. |
Review effort: Balanced
Every open PR currently fails CI on the macOS jobs (for example model-checking#5037). This fixes it; once it lands, the other PRs only need a rerun. **Why it broke.** Homebrew stopped shipping bottles for macOS 14 (now "Tier 3") and for Intel Macs, so `brew install` compiles from source on both of our macOS runners. z3 5.3.1 came out on 2026-10-15, the day after `main`'s last green run, and doesn't compile with the macos-14 runner's clang (`no known conversion from 'symbol' to 'symbol_table<int>::key_data'` in `src/ast/ast.cpp`). That fails `regression (macos-14)`, `verify-std (macos-14)` and `BuildBundle-MacOs-aarch64`; matrix fail-fast then cancels the Linux and Intel jobs, which show up red as well. **The fix**, in `scripts/setup/macos/install_deps.sh` (every `macos-*` setup directory links to it): - Install z3 from the official release binaries (`z3-5.3.1-{arm64,x64}-osx-13.3.zip`), the same way the script already installs cvc5. The binary only links system libraries, so copying `bin/z3` is enough. - Stop running `brew install python@3`. It was a workaround for Homebrew upgrading the runner's Python while installing other formulae (actions/runner-images#9471). Nothing installed here uses Homebrew's Python any more, and on macos-15-intel compiling it and its dependencies took most of the 29-minute setup on the last green run. **What to check.** This PR's own macOS jobs are the test. The one risk is a macOS step that needed a newer Python than the runner image ships; I didn't find one (the only `pip` use is in the Ubuntu benchcomp job). CBMC stays on Homebrew: diffblue's tap has 6.11.0 bottles for both `arm64_sonoma` and Intel `sonoma`. Not addressed here: GitHub retires the macOS Intel runners in 2027, so `macos-15-intel` will need replacing at some point.
feliperodri
left a comment
There was a problem hiding this comment.
Thanks for this. Treating abort_immediate like abort is the right model: the failed assertion is followed by assume(false), so reaching it is always reported and nothing past it gets explored, which fits an intrinsic that returns ! and runs no destructors. Two small notes inline, neither blocking. The red CI is the macOS Homebrew/z3 breakage that #5038 fixes; a rerun after it lands should clear it.
The gotoc backend handles abort but not abort_immediate. As of nightly-2026-10-11, core::intrinsics no longer declares abort; abort_immediate is its renamed successor (same documented behavior, behind the unstable core::process::abort_immediate), and the standard library calls it directly, e.g. in Rc's reference-count overflow guards. Any harness reaching it fails with 'Unsupported intrinsic abort_immediate', including previously-passing #[kani::should_panic] overflow harnesses in verify-rust-std at that toolchain. Handle abort_immediate exactly like abort: reaching it is a failed assertion.
- Note the should_panic test differs from #[should_panic] under cargo test, where an abort is not a panic. - Comment the retained "abort" match arm: renamed to abort_immediate, kept for toolchains predating the rename.
9daae82 to
6442753
Compare
@feliperodri Thanks for the review! I added comments for both notes and updated the PR. |
65de6a9
The gotoc backend handles
abortbut notabort_immediate.As of nightly-2026-10-11,
core::intrinsicsno longer declaresabort.abort_immediateis its renamed successor, and the standard library calls it directly (e.g. inRc's reference-count overflow guards). Harnesses reaching it fail withUnsupported intrinsic abort_immediate.This handles
abort_immediateexactly likeabort: reaching it is a failed assertion.Manual testing: against verify-rust-std at its nightly-2026-10-11 pin, the two
Rcoverflowshould_panicharnesses in model-checking/verify-rust-std#661 fail with the unsupported-intrinsic error before this change and verify successfully with it.Resolves #5036
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.