Skip to content

Spurious failure for enum with array data #2416

@zhassan-aws

Description

@zhassan-aws

I tried this code:

#[derive(Clone, PartialEq, Eq)]
enum Foo {
    A,
    B([u8; 65])
}

#[kani::proof]
fn main() {
    let x: Foo = Foo::B(kani::any());
    let b = x.clone();
    assert_eq!(b, x);
}

using the following command line invocation:

kani test.rs

with Kani version:

I expected to see this happen: Verification successful

Instead, this happened: Verification failed:

SUMMARY:
 ** 1 of 52 failed
Failed Checks: assertion failed: b == x
 File: "/home/ubuntu/examples/enum_bug/test.rs", line 11, in main

VERIFICATION:- FAILED

Weird enough, this only happens if the array size is 65 or larger! If I make the array size 64 or less, verification passes!


SUMMARY:
 ** 0 of 52 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 0.27921867s

Metadata

Metadata

Assignees

Labels

T-CBMCIssue related to an existing CBMC issue[C] BugThis is a bug. Something isn't working.[F] Spurious FailureIssues that cause Kani verification to fail despite the code being correct.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions