You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Uninit checks: false alarm reading an array of a repeated initialized MaybeUninit #5229
Z-UnstableFeatureIssues that only occur if a unstable feature is enabled[C] BugThis is a bug. Something isn't working.[F] Spurious FailureIssues that cause Kani verification to fail despite the code being correct.
With -Z uninit-checks, reading an element of an array built by repeating an initialized MaybeUninit is reported as an uninitialized read:
use std::mem::MaybeUninit;#[kani::proof]fnrepeat_maybe_uninit(){let a = [MaybeUninit::new(1u32);3];let x = unsafe{ a[kani::any_where(|i:&usize| *i < 3)].assume_init()};assert!(x == 1);}
Failed Checks: Undefined Behavior: Reading from an uninitialized pointer of type `*const std::mem::MaybeUninit<u32>`
Every element is initialized, so this is a false alarm. The Rvalue::Repeat assignment of a type with union bytes resets the destination's state instead of copying the state of the repeated operand into each element. Reported by @rajath-mk in the review of #5196, where [MaybeUninit<T>; N] became supported; reproduced on #5196's branch.
Z-UnstableFeatureIssues that only occur if a unstable feature is enabled[C] BugThis is a bug. Something isn't working.[F] Spurious FailureIssues that cause Kani verification to fail despite the code being correct.
Activity