Repository navigation
Replace the unchecked_mul harnesses with autoharness - #809
Open
bardiharborow wants to merge 1 commit into
Open
bardiharborow wants to merge 1 commit into
bardiharborow wants to merge 1 commit into
Conversation
Remove the 36 hand-written `unchecked_mul` harnesses and verify all 12 integer types with autoharness instead, over all inputs that satisfy the contract. 24 of the removed harnesses were vacuous. Both operands were restricted to an interval in which every product overflows, and the product was then assumed not to overflow, so `unchecked_mul` was never called. For the 32-bit and wider types and `isize`/`usize`, only products of operands in `-10..=10` (signed) or `0..=10` (unsigned) were verified. The ESBMC workflow ran on four of the removed harnesses, so point it at the `NonZero::unchecked_mul` harnesses for `i8`, `i16`, `u8` and `u16`, which call the primitive `unchecked_mul`.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the replacement of manual unchecked_mul harnesses with Kani autoharness coverage.
No open issues 🎉
What changed in this PR
This PR addresses #808 by replacing hand-written unchecked_mul harnesses with Kani autoharness coverage for all 12 integer types, targeting all contract-valid inputs without changing standard-library runtime logic.
Changes:
- Removes 36 manual harnesses, including 24 with unsatisfiable assumptions.
- Adds all 12 primitive
unchecked_mulmethods to the Kani autoharness selection. - Retargets ESBMC to existing
NonZero::unchecked_mulharnesses that call primitive multiplication.
| File | Description |
|---|---|
scripts/run-esbmc.sh |
Updates comments showing example harness filenames and entry points; no behavior change. |
library/core/src/num/mod.rs |
Removes manual unchecked_mul harnesses and their generation macros. |
.github/workflows/kani.yml |
Adds autoharness selection patterns for all 12 integer types. |
.github/workflows/esbmc.yml |
Selects NonZero multiplication harnesses instead of the removed primitive harnesses. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove the 36 hand-written
unchecked_mulharnesses and verify all 12 integer types with autoharness instead, over all inputs that satisfy the contract.24 of the removed harnesses were vacuous. Both operands were restricted to an interval in which every product overflows, and the product was then assumed not to overflow, so
unchecked_mulwas never called. For the 32-bit and wider types andisize/usize, only products of operands in-10..=10(signed) or0..=10(unsigned) were verified.The ESBMC workflow ran on four of the removed harnesses, so point it at the
NonZero::unchecked_mulharnesses fori8,i16,u8andu16, which call the primitiveunchecked_mul.Resolves #808
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.