prusti-dev icon indicating copy to clipboard operation
prusti-dev copied to clipboard

Overflow checks for division and remainder even when disabled

Open vfukala opened this issue 2 years ago • 0 comments

Even when the overflow checks are disabled (check_overflows = false is set),

#[requires(b != 0)]
fn do_div(a: i32, b: i32) -> i32 {
    a / b
}

and

#[requires(b != 0)]
fn do_rem(a: i32, b: i32) -> i32 {
    a % b
}

fail to verify with

error: [Prusti: verification error] assertion might fail with "attempt to divide with overflow"

and

error: [Prusti: verification error] assertion might fail with "attempt to calculate the remainder with overflow"

respectively.

vfukala avatar Mar 05 '23 13:03 vfukala