Skip to content

Support the abort_immediate intrinsic - #5037

Merged
feliperodri merged 2 commits into
model-checking:mainfrom
kasimte:abort-immediate-intrinsic
Oct 22, 2026
Merged

feliperodri merged 2 commits into
model-checking:mainfrom
kasimte:abort-immediate-intrinsic

Conversation

@kasimte

@kasimte kasimte commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

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, and the standard library calls it directly (e.g. in Rc's reference-count overflow guards). Harnesses reaching it fail with Unsupported intrinsic abort_immediate.

This handles abort_immediate exactly like abort: reaching it is a failed assertion.

Manual testing: against verify-rust-std at its nightly-2026-10-11 pin, the two Rc overflow should_panic harnesses 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.

@kasimte
kasimte requested review from a team as code owners October 21, 2026 14:23
@github-actions github-actions Bot added Z-EndToEndBenchCI Tag a PR to run benchmark CI Z-CompilerBenchCI Tag a PR to run benchmark CI labels Oct 21, 2026
@feliperodri
feliperodri requested a balanced review from Copilot October 21, 2026 14:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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_panic harnesses.
  • 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

feliperodri added a commit to kasimte/kani that referenced this pull request Oct 21, 2026
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 feliperodri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@kasimte
kasimte force-pushed the abort-immediate-intrinsic branch from 9daae82 to 6442753 Compare October 22, 2026 00:23
@kasimte

kasimte commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

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.

@feliperodri Thanks for the review! I added comments for both notes and updated the PR.

@feliperodri
feliperodri enabled auto-merge October 22, 2026 01:23
@feliperodri
feliperodri added this pull request to the merge queue Oct 22, 2026
Merged via the queue into model-checking:main with commit 65de6a9 Oct 22, 2026
32 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Z-CompilerBenchCI Tag a PR to run benchmark CI Z-EndToEndBenchCI Tag a PR to run benchmark CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unsupported intrinsic abort_immediate (reached by Rc's overflow guards as of nightly-2026-10-11)

3 participants