generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 131
Closed
Labels
[C] Feature / EnhancementA new feature request or enhancement to an existing feature.A new feature request or enhancement to an existing feature.[E] PerformanceTrack performance improvement (Time / Memory / CPU)Track performance improvement (Time / Memory / CPU)
Description
Currently, the Rust by Example/Scoping rules/RAII/11.rs fails to verify with default CBMC values. See the example below:
#![allow(unused)]
// raii.rs
fn create_box() {
// Allocate an integer on the heap
let _box1 = Box::new(3i32);
// `_box1` is destroyed here, and memory gets freed
}
pub fn main() {
// Allocate an integer on the heap
let _box2 = Box::new(5i32);
// A nested scope:
{
// Allocate an integer on the heap
let _box3 = Box::new(4i32);
// `_box3` is destroyed here, and memory gets freed
}
// Creating lots of boxes just for fun
// There's no need to manually free memory!
for _ in 0u32..1_000 {
create_box();
}
// `_box2` is destroyed here, and memory gets freed
}The create_box creates a box, then frees its memory since it goes out of scope.
One needs to use --cbmc-args --object-bits 13 in order to successfully verify this example, but even then it takes 5 minutes to do so.
As far as I can tell, this is a good candidate for verification optimizations.
Metadata
Metadata
Assignees
Labels
[C] Feature / EnhancementA new feature request or enhancement to an existing feature.A new feature request or enhancement to an existing feature.[E] PerformanceTrack performance improvement (Time / Memory / CPU)Track performance improvement (Time / Memory / CPU)