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
#[cfg_attr(miri, ignore)]// isolated Miri does not support benchmarks
fnbench_pop_back_100(b:&mut test::Bencher){
letmut deq = VecDeque::<i32>::with_capacity(101);
b.iter(|| {
deq.head = 100;
deq.tail = 0;
while !deq.is_empty(){
test::black_box(deq.pop_back());
It directly accesses private fields of VecDeque to set the head and tail pointers, but doesn't initialize the element in the middle so pop_back reads uninitialized memory.
The text was updated successfully, but these errors were encountered:
run alloc benchmarks in Miri and fix UB
Miri since recently has a "fake monotonic clock" that works even with isolation. Its measurements are not very meaningful but it means we can run these benches and check them for UB.
And that's a good thing since there was UB here: fixesrust-lang#104096.
r? `@thomcc`
run alloc benchmarks in Miri and fix UB
Miri since recently has a "fake monotonic clock" that works even with isolation. Its measurements are not very meaningful but it means we can run these benches and check them for UB.
And that's a good thing since there was UB here: fixesrust-lang/rust#104096.
r? ``@thomcc``
This benchmark function has UB:
rust/library/alloc/src/collections/vec_deque/tests.rs
Lines 29 to 40 in bc3fae4
It directly accesses private fields of
VecDeque
to set the head and tail pointers, but doesn't initialize the element in the middle sopop_back
reads uninitialized memory.The text was updated successfully, but these errors were encountered: