Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use the log crate + env_logger #16

Merged
merged 9 commits into from
Jun 1, 2016
Merged

use the log crate + env_logger #16

merged 9 commits into from
Jun 1, 2016

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jun 1, 2016

The MIRI_LOG env var can now be used to change the logging granularity.

Example output:

DEBUG:miri::interpreter| Interpreting: out_of_bounds_read
TRACE:miri::interpreter|  // bb0
TRACE:miri::interpreter|  tmp3 = Box([u8; 2])
TRACE:miri::interpreter|  (*tmp3) = [const 1u8, const 2u8]
TRACE:miri::interpreter|  tmp2 = tmp3
TRACE:miri::interpreter|  tmp1 = tmp2 as Box<[u8]> (Unsize)
TRACE:miri::interpreter|  var0 = std::slice::<impl [T]><u8>::into_vec(tmp1) -> [return: bb5, unwind: bb4]
TRACE:miri::interpreter|   // bb0
TRACE:miri::interpreter|   var0 = arg0
TRACE:miri::interpreter|   tmp1 = var0
TRACE:miri::interpreter|   return = std::slice::hack::into_vec::<T>(tmp1) -> [return: bb5, unwind: bb4]
TRACE:miri::interpreter|    // bb0
TRACE:miri::interpreter|    var0 = arg0
TRACE:miri::interpreter|    tmp2 = &mut (*var0)
TRACE:miri::interpreter|    tmp1 = std::slice::<impl [T]><T>::as_mut_ptr(tmp2) -> [return: bb5, unwind: bb17]
TRACE:miri::interpreter|     // bb0
TRACE:miri::interpreter|     var0 = arg0
TRACE:miri::interpreter|     tmp0 = &mut (*var0)
TRACE:miri::interpreter|     return = <[T] as core::slice::SliceExt>::as_mut_ptr(tmp0) -> bb1
TRACE:miri::interpreter|    | // bb0
TRACE:miri::interpreter|    | var0 = arg0
TRACE:miri::interpreter|    | tmp1 = &mut (*var0)
TRACE:miri::interpreter|    | tmp0 = tmp1 as *mut [T] (Misc)
TRACE:miri::interpreter|    | return = tmp0 as *mut T (Misc)
TRACE:miri::interpreter|    | return
TRACE:miri::interpreter|     // bb1
TRACE:miri::interpreter|     return
TRACE:miri::interpreter|    // bb5
TRACE:miri::interpreter|    tmp4 = &(*var0)
TRACE:miri::interpreter|    tmp3 = std::slice::<impl [T]><T>::len(tmp4) -> [return: bb6, unwind: bb18]
TRACE:miri::interpreter|     // bb0
TRACE:miri::interpreter|     var0 = arg0
TRACE:miri::interpreter|     tmp0 = &(*var0)
TRACE:miri::interpreter|     return = <[T] as core::slice::SliceExt>::len(tmp0) -> bb1
TRACE:miri::interpreter|    | // bb0
TRACE:miri::interpreter|    | var0 = arg0
TRACE:miri::interpreter|    | tmp2 = &(*var0)
TRACE:miri::interpreter|    | tmp1 = std::mem::transmute::<&'static [T], core::slice::Repr<T>>(tmp2) -> bb1
TRACE:miri::interpreter|    | // bb1
TRACE:miri::interpreter|    | tmp0 = (tmp1.1: usize)
TRACE:miri::interpreter|    | return = tmp0
TRACE:miri::interpreter|    | return
TRACE:miri::interpreter|     // bb1
TRACE:miri::interpreter|     return
TRACE:miri::interpreter|    // bb6
TRACE:miri::interpreter|    tmp6 = &(*var0)
TRACE:miri::interpreter|    tmp5 = std::slice::<impl [T]><T>::len(tmp6) -> [return: bb7, unwind: bb19]
TRACE:miri::interpreter|     // bb0
TRACE:miri::interpreter|     var0 = arg0
TRACE:miri::interpreter|     tmp0 = &(*var0)
TRACE:miri::interpreter|     return = <[T] as core::slice::SliceExt>::len(tmp0) -> bb1
TRACE:miri::interpreter|    | // bb0
TRACE:miri::interpreter|    | var0 = arg0
TRACE:miri::interpreter|    | tmp2 = &(*var0)
TRACE:miri::interpreter|    | tmp1 = std::mem::transmute::<&'static [T], core::slice::Repr<T>>(tmp2) -> bb1
TRACE:miri::interpreter|    | // bb1
TRACE:miri::interpreter|    | tmp0 = (tmp1.1: usize)
TRACE:miri::interpreter|    | return = tmp0
TRACE:miri::interpreter|    | return
TRACE:miri::interpreter|     // bb1
TRACE:miri::interpreter|     return
TRACE:miri::interpreter|    // bb7
TRACE:miri::interpreter|    var1 = <std::vec::Vec<T>><T>::from_raw_parts(tmp1, tmp3, tmp5) -> [return: bb8, unwind: bb20]
TRACE:miri::interpreter|     // bb0
TRACE:miri::interpreter|     var0 = arg0
TRACE:miri::interpreter|     var1 = arg1
TRACE:miri::interpreter|     var2 = arg2
TRACE:miri::interpreter|     tmp1 = var0
TRACE:miri::interpreter|     tmp2 = var2
TRACE:miri::interpreter|     tmp0 = <alloc::raw_vec::RawVec<T>><T>::from_raw_parts(tmp1, tmp2) -> bb1
TRACE:miri::interpreter|    | // bb0
TRACE:miri::interpreter|    | var0 = arg0
TRACE:miri::interpreter|    | var1 = arg1
TRACE:miri::interpreter|    | tmp1 = var0
TRACE:miri::interpreter|    | tmp0 = <std::ptr::Unique<T>><T>::new(tmp1) -> bb1
TRACE:miri::interpreter|    |  // bb0
TRACE:miri::interpreter|    |  var0 = arg0
TRACE:miri::interpreter|    |  tmp2 = var0
TRACE:miri::interpreter|    |  tmp1 = tmp2 as *const T (Misc)
TRACE:miri::interpreter|    |  tmp0 = <core::nonzero::NonZero<T>><*const T>::new(tmp1) -> bb1
TRACE:miri::interpreter|    |   // bb0
TRACE:miri::interpreter|    |   var0 = arg0
TRACE:miri::interpreter|    |   tmp0 = var0
TRACE:miri::interpreter|    |   return = core::nonzero::NonZero::{{constructor}}<T>(tmp0,)
TRACE:miri::interpreter|    |   drop(tmp0) -> [return: bb4, unwind: bb3]
DEBUG:miri::interpreter|    |   no need to drop *const u8
TRACE:miri::interpreter|    |   // bb4
TRACE:miri::interpreter|    |   drop(arg0) -> [return: bb5, unwind: bb7]
DEBUG:miri::interpreter|    |   no need to drop *const u8
TRACE:miri::interpreter|    |   // bb5
TRACE:miri::interpreter|    |   drop(var0) -> bb6
DEBUG:miri::interpreter|    |   no need to drop *const u8
TRACE:miri::interpreter|    |   // bb6
TRACE:miri::interpreter|    |   return
TRACE:miri::interpreter|    |  // bb1
TRACE:miri::interpreter|    |  tmp3 = std::marker::PhantomData::{{constructor}}<T>
TRACE:miri::interpreter|    |  return = std::ptr::Unique<T> { pointer: tmp0, _marker: tmp3 }
TRACE:miri::interpreter|    |  return
TRACE:miri::interpreter|    | // bb1
TRACE:miri::interpreter|    | tmp2 = var1
TRACE:miri::interpreter|    | return = alloc::raw_vec::RawVec<T> { ptr: tmp0, cap: tmp2 }
TRACE:miri::interpreter|    | return
TRACE:miri::interpreter|     // bb1
TRACE:miri::interpreter|     tmp4 = var1
TRACE:miri::interpreter|     return = std::vec::Vec<T> { buf: tmp0, len: tmp4 }
TRACE:miri::interpreter|     drop(tmp0) -> bb2
TRACE:miri::interpreter|     -need to drop alloc::raw_vec::RawVec<u8>
TRACE:miri::interpreter|     // bb2
TRACE:miri::interpreter|     return
TRACE:miri::interpreter|    // bb8
TRACE:miri::interpreter|    tmp8 = var0
TRACE:miri::interpreter|    tmp7 = std::mem::forget::<Box<[T]>>(tmp8) -> [return: bb10, unwind: bb9]
TRACE:miri::interpreter|     // bb0
TRACE:miri::interpreter|     var0 = arg0
TRACE:miri::interpreter|     tmp1 = var0
TRACE:miri::interpreter|     return = std::intrinsics::::forget::<T>(tmp1) -> [return: bb5, unwind: bb4]
TRACE:miri::interpreter|     // bb5
TRACE:miri::interpreter|     drop(tmp1) -> [return: bb6, unwind: bb9]
TRACE:miri::interpreter|     -need to drop Box<[u8]>
TRACE:miri::interpreter|     // bb6
TRACE:miri::interpreter|     drop(arg0) -> [return: bb7, unwind: bb10]
TRACE:miri::interpreter|     -need to drop Box<[u8]>
TRACE:miri::interpreter|     // bb7
TRACE:miri::interpreter|     drop(var0) -> bb8
TRACE:miri::interpreter|     -need to drop Box<[u8]>
TRACE:miri::interpreter|     // bb8
TRACE:miri::interpreter|     return
TRACE:miri::interpreter|    // bb10
TRACE:miri::interpreter|    drop(tmp8) -> [return: bb11, unwind: bb21]
TRACE:miri::interpreter|    -need to drop Box<[u8]>
TRACE:miri::interpreter|    // bb11
TRACE:miri::interpreter|    tmp9 = var1
TRACE:miri::interpreter|    return = tmp9
TRACE:miri::interpreter|    drop(var1) -> [return: bb13, unwind: bb12]
TRACE:miri::interpreter|    -need to drop std::vec::Vec<u8>
TRACE:miri::interpreter|    // bb13
TRACE:miri::interpreter|    drop(tmp9) -> [return: bb14, unwind: bb22]
TRACE:miri::interpreter|    -need to drop std::vec::Vec<u8>
TRACE:miri::interpreter|    // bb14
TRACE:miri::interpreter|    drop(arg0) -> [return: bb15, unwind: bb23]
TRACE:miri::interpreter|    -need to drop Box<[u8]>
TRACE:miri::interpreter|    // bb15
TRACE:miri::interpreter|    drop(var0) -> bb16
TRACE:miri::interpreter|    -need to drop Box<[u8]>
TRACE:miri::interpreter|    // bb16
TRACE:miri::interpreter|    return
TRACE:miri::interpreter|   // bb5
TRACE:miri::interpreter|   drop(tmp1) -> [return: bb6, unwind: bb9]
TRACE:miri::interpreter|   -need to drop Box<[u8]>
TRACE:miri::interpreter|   // bb6
TRACE:miri::interpreter|   drop(arg0) -> [return: bb7, unwind: bb10]
TRACE:miri::interpreter|   -need to drop Box<[u8]>
TRACE:miri::interpreter|   // bb7
TRACE:miri::interpreter|   drop(var0) -> bb8
TRACE:miri::interpreter|   -need to drop Box<[u8]>
TRACE:miri::interpreter|   // bb8
TRACE:miri::interpreter|   return
TRACE:miri::interpreter|  // bb5
TRACE:miri::interpreter|  drop(tmp1) -> [return: bb6, unwind: bb3]
TRACE:miri::interpreter|  -need to drop Box<[u8]>
TRACE:miri::interpreter|  // bb6
TRACE:miri::interpreter|  drop(tmp2) -> [return: bb7, unwind: bb2]
TRACE:miri::interpreter|  -need to drop Box<[u8; 2]>
TRACE:miri::interpreter|  // bb7
TRACE:miri::interpreter|  tmp8 = &var0
TRACE:miri::interpreter|  tmp7 = <std::vec::Vec<u8> as std::ops::Deref>::deref(tmp8) -> [return: bb8, unwind: bb2]
TRACE:miri::interpreter|   // bb0
TRACE:miri::interpreter|   var0 = arg0
TRACE:miri::interpreter|   tmp0 = &((*var0).0: alloc::raw_vec::RawVec<T>)
TRACE:miri::interpreter|   var1 = <alloc::raw_vec::RawVec<T>><T>::ptr(tmp0) -> bb1
TRACE:miri::interpreter|    // bb0
TRACE:miri::interpreter|    var0 = arg0
TRACE:miri::interpreter|    tmp2 = &((*var0).0: std::ptr::Unique<T>)
TRACE:miri::interpreter|    tmp1 = <std::ptr::Unique<T> as std::ops::Deref>::deref(tmp2) -> bb1
TRACE:miri::interpreter|     // bb0
TRACE:miri::interpreter|     var0 = arg0
TRACE:miri::interpreter|     tmp2 = &((*var0).0: core::nonzero::NonZero<*const T>)
TRACE:miri::interpreter|     tmp1 = <core::nonzero::NonZero<*const T> as std::ops::Deref>::deref(tmp2) -> bb1
TRACE:miri::interpreter|    | // bb0
TRACE:miri::interpreter|    | var0 = arg0
TRACE:miri::interpreter|    | var1 = &((*var0).0: T)
TRACE:miri::interpreter|    | return = &(*var1)
TRACE:miri::interpreter|    | return
TRACE:miri::interpreter|     // bb1
TRACE:miri::interpreter|     tmp0 = &(*tmp1)
TRACE:miri::interpreter|     return = std::mem::transmute::<&'static *const T, &'static *mut T>(tmp0) -> bb2
TRACE:miri::interpreter|     // bb2
TRACE:miri::interpreter|     return
TRACE:miri::interpreter|    // bb1
TRACE:miri::interpreter|    tmp0 = (*tmp1)
TRACE:miri::interpreter|    return = tmp0
TRACE:miri::interpreter|    return
TRACE:miri::interpreter|   // bb1
TRACE:miri::interpreter|   tmp4 = var1
TRACE:miri::interpreter|   tmp3 = std::ptr::<impl *mut T><T>::is_null(tmp4) -> bb2
TRACE:miri::interpreter|    // bb0
TRACE:miri::interpreter|    var0 = arg0
TRACE:miri::interpreter|    tmp0 = var0
TRACE:miri::interpreter|    tmp1 = std::ptr::null_mut::<T>() -> bb1
TRACE:miri::interpreter|     // bb0
TRACE:miri::interpreter|     return = const 0usize as *mut T (Misc)
TRACE:miri::interpreter|     return
TRACE:miri::interpreter|    // bb1
TRACE:miri::interpreter|    return = Eq(tmp0, tmp1)
TRACE:miri::interpreter|    return
TRACE:miri::interpreter|   // bb2
TRACE:miri::interpreter|   tmp2 = Not(tmp3)
TRACE:miri::interpreter|   tmp1 = std::intrinsics::::assume(tmp2) -> bb3
TRACE:miri::interpreter|   // bb3
TRACE:miri::interpreter|   tmp7 = var1
TRACE:miri::interpreter|   tmp6 = tmp7 as *const T (Misc)
TRACE:miri::interpreter|   tmp8 = ((*var0).1: usize)
TRACE:miri::interpreter|   tmp5 = std::slice::from_raw_parts::<T>(tmp6, tmp8) -> bb4
TRACE:miri::interpreter|    // bb0
TRACE:miri::interpreter|    var0 = arg0
TRACE:miri::interpreter|    var1 = arg1
TRACE:miri::interpreter|    tmp1 = var0
TRACE:miri::interpreter|    tmp2 = var1
TRACE:miri::interpreter|    tmp0 = core::slice::Repr<T> { data: tmp1, len: tmp2 }
TRACE:miri::interpreter|    return = std::mem::transmute::<core::slice::Repr<T>, &'static [T]>(tmp0) -> bb1
TRACE:miri::interpreter|    // bb1
TRACE:miri::interpreter|    return
TRACE:miri::interpreter|   // bb4
TRACE:miri::interpreter|   return = &(*tmp5)
TRACE:miri::interpreter|   return
TRACE:miri::interpreter|  // bb8
TRACE:miri::interpreter|  tmp6 = &(*tmp7)
TRACE:miri::interpreter|  tmp5 = std::slice::<impl [T]><u8>::get_unchecked(tmp6, const 5usize) -> [return: bb9, unwind: bb2]
TRACE:miri::interpreter|   // bb0
TRACE:miri::interpreter|   var0 = arg0
TRACE:miri::interpreter|   var1 = arg1
TRACE:miri::interpreter|   tmp1 = &(*var0)
TRACE:miri::interpreter|   tmp2 = var1
TRACE:miri::interpreter|   tmp0 = <[T] as core::slice::SliceExt>::get_unchecked(tmp1, tmp2) -> bb1
TRACE:miri::interpreter|    // bb0
TRACE:miri::interpreter|    var0 = arg0
TRACE:miri::interpreter|    var1 = arg1
TRACE:miri::interpreter|    tmp3 = &(*var0)
TRACE:miri::interpreter|    tmp2 = <[T] as core::slice::SliceExt>::as_ptr(tmp3) -> bb1
TRACE:miri::interpreter|     // bb0
TRACE:miri::interpreter|     var0 = arg0
TRACE:miri::interpreter|     tmp1 = &(*var0)
TRACE:miri::interpreter|     tmp0 = tmp1 as *const [T] (Misc)
TRACE:miri::interpreter|     return = tmp0 as *const T (Misc)
TRACE:miri::interpreter|     return
TRACE:miri::interpreter|    // bb1
TRACE:miri::interpreter|    tmp5 = var1
TRACE:miri::interpreter|    tmp4 = tmp5 as isize (Misc)
TRACE:miri::interpreter|    tmp1 = std::ptr::<impl *const T><T>::offset(tmp2, tmp4) -> bb2
TRACE:miri::interpreter|     // bb0
TRACE:miri::interpreter|     var0 = arg0
TRACE:miri::interpreter|     var1 = arg1
TRACE:miri::interpreter|     tmp0 = var0
TRACE:miri::interpreter|     tmp1 = var1
TRACE:miri::interpreter|     return = std::intrinsics::::offset::<T>(tmp0, tmp1) -> bb1
TRACE:miri::interpreter|     // bb1
TRACE:miri::interpreter|     return
TRACE:miri::interpreter|    // bb2
TRACE:miri::interpreter|    tmp0 = &(*tmp1)
TRACE:miri::interpreter|    return = &(*tmp0)
TRACE:miri::interpreter|    return
TRACE:miri::interpreter|   // bb1
TRACE:miri::interpreter|   return = &(*tmp0)
TRACE:miri::interpreter|   return
TRACE:miri::interpreter|  // bb9
TRACE:miri::interpreter|  tmp4 = (*tmp5)
tests/compile-fail/errors.rs:39:14: 39:33 error: memory access of 5..6 outside bounds of allocation 11 which has size 2
tests/compile-fail/errors.rs:39     unsafe { *v.get_unchecked(5) } //~ ERROR: memory access of 5..6 outside bounds of allocation 11 which has size 2
                                             ^~~~~~~~~~~~~~~~~~~

let format = |record: &log::LogRecord| {
// prepend spaces to indent the final string
let indentation = log_settings::settings().indentation;
let spaces = " ";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you were going for a max indentation here? It'd be nice to handle that in numbers rather than having this string which I'm not sure how long it is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice if the indentation wrapped around to 0 when it gets too long with an indicator that it's actually extra-deep.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 1, 2016

updated

@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 1, 2016

updated:

DEBUG:miri::interpreter 0 Interpreting: cake
TRACE:miri::interpreter 0  // bb0
TRACE:miri::interpreter 0  tmp0 = cake::foo(const 0i32) -> bb1
TRACE:miri::interpreter 0   // bb0
TRACE:miri::interpreter 0   var0 = arg0
TRACE:miri::interpreter 0   tmp1 = var0
TRACE:miri::interpreter 0   tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0   if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0   // bb2
TRACE:miri::interpreter 0   tmp5 = var0
TRACE:miri::interpreter 0   tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0   tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0    // bb0
TRACE:miri::interpreter 0    var0 = arg0
TRACE:miri::interpreter 0    tmp1 = var0
TRACE:miri::interpreter 0    tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0    if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0    // bb2
TRACE:miri::interpreter 0    tmp5 = var0
TRACE:miri::interpreter 0    tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0    tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0     // bb0
TRACE:miri::interpreter 0     var0 = arg0
TRACE:miri::interpreter 0     tmp1 = var0
TRACE:miri::interpreter 0     tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0     if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0     // bb2
TRACE:miri::interpreter 0     tmp5 = var0
TRACE:miri::interpreter 0     tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0     tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0      // bb0
TRACE:miri::interpreter 0      var0 = arg0
TRACE:miri::interpreter 0      tmp1 = var0
TRACE:miri::interpreter 0      tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0      if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0      // bb2
TRACE:miri::interpreter 0      tmp5 = var0
TRACE:miri::interpreter 0      tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0      tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0       // bb0
TRACE:miri::interpreter 0       var0 = arg0
TRACE:miri::interpreter 0       tmp1 = var0
TRACE:miri::interpreter 0       tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0       if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0       // bb2
TRACE:miri::interpreter 0       tmp5 = var0
TRACE:miri::interpreter 0       tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0       tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0        // bb0
TRACE:miri::interpreter 0        var0 = arg0
TRACE:miri::interpreter 0        tmp1 = var0
TRACE:miri::interpreter 0        tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0        if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0        // bb2
TRACE:miri::interpreter 0        tmp5 = var0
TRACE:miri::interpreter 0        tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0        tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0         // bb0
TRACE:miri::interpreter 0         var0 = arg0
TRACE:miri::interpreter 0         tmp1 = var0
TRACE:miri::interpreter 0         tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0         if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0         // bb2
TRACE:miri::interpreter 0         tmp5 = var0
TRACE:miri::interpreter 0         tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0         tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0          // bb0
TRACE:miri::interpreter 0          var0 = arg0
TRACE:miri::interpreter 0          tmp1 = var0
TRACE:miri::interpreter 0          tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0          if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0          // bb2
TRACE:miri::interpreter 0          tmp5 = var0
TRACE:miri::interpreter 0          tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0          tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0           // bb0
TRACE:miri::interpreter 0           var0 = arg0
TRACE:miri::interpreter 0           tmp1 = var0
TRACE:miri::interpreter 0           tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0           if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0           // bb2
TRACE:miri::interpreter 0           tmp5 = var0
TRACE:miri::interpreter 0           tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0           tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0            // bb0
TRACE:miri::interpreter 0            var0 = arg0
TRACE:miri::interpreter 0            tmp1 = var0
TRACE:miri::interpreter 0            tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0            if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0            // bb2
TRACE:miri::interpreter 0            tmp5 = var0
TRACE:miri::interpreter 0            tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0            tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0             // bb0
TRACE:miri::interpreter 0             var0 = arg0
TRACE:miri::interpreter 0             tmp1 = var0
TRACE:miri::interpreter 0             tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0             if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0             // bb2
TRACE:miri::interpreter 0             tmp5 = var0
TRACE:miri::interpreter 0             tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0             tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0              // bb0
TRACE:miri::interpreter 0              var0 = arg0
TRACE:miri::interpreter 0              tmp1 = var0
TRACE:miri::interpreter 0              tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0              if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0              // bb2
TRACE:miri::interpreter 0              tmp5 = var0
TRACE:miri::interpreter 0              tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0              tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0               // bb0
TRACE:miri::interpreter 0               var0 = arg0
TRACE:miri::interpreter 0               tmp1 = var0
TRACE:miri::interpreter 0               tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0               if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0               // bb2
TRACE:miri::interpreter 0               tmp5 = var0
TRACE:miri::interpreter 0               tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0               tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                // bb0
TRACE:miri::interpreter 0                var0 = arg0
TRACE:miri::interpreter 0                tmp1 = var0
TRACE:miri::interpreter 0                tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                // bb2
TRACE:miri::interpreter 0                tmp5 = var0
TRACE:miri::interpreter 0                tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                 // bb0
TRACE:miri::interpreter 0                 var0 = arg0
TRACE:miri::interpreter 0                 tmp1 = var0
TRACE:miri::interpreter 0                 tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                 if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                 // bb2
TRACE:miri::interpreter 0                 tmp5 = var0
TRACE:miri::interpreter 0                 tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                 tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                  // bb0
TRACE:miri::interpreter 0                  var0 = arg0
TRACE:miri::interpreter 0                  tmp1 = var0
TRACE:miri::interpreter 0                  tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                  if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                  // bb2
TRACE:miri::interpreter 0                  tmp5 = var0
TRACE:miri::interpreter 0                  tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                  tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                   // bb0
TRACE:miri::interpreter 0                   var0 = arg0
TRACE:miri::interpreter 0                   tmp1 = var0
TRACE:miri::interpreter 0                   tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                   if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                   // bb2
TRACE:miri::interpreter 0                   tmp5 = var0
TRACE:miri::interpreter 0                   tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                   tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                    // bb0
TRACE:miri::interpreter 0                    var0 = arg0
TRACE:miri::interpreter 0                    tmp1 = var0
TRACE:miri::interpreter 0                    tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                    if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                    // bb2
TRACE:miri::interpreter 0                    tmp5 = var0
TRACE:miri::interpreter 0                    tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                    tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                     // bb0
TRACE:miri::interpreter 0                     var0 = arg0
TRACE:miri::interpreter 0                     tmp1 = var0
TRACE:miri::interpreter 0                     tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                     if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                     // bb2
TRACE:miri::interpreter 0                     tmp5 = var0
TRACE:miri::interpreter 0                     tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                     tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                      // bb0
TRACE:miri::interpreter 0                      var0 = arg0
TRACE:miri::interpreter 0                      tmp1 = var0
TRACE:miri::interpreter 0                      tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                      if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                      // bb2
TRACE:miri::interpreter 0                      tmp5 = var0
TRACE:miri::interpreter 0                      tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                      tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                       // bb0
TRACE:miri::interpreter 0                       var0 = arg0
TRACE:miri::interpreter 0                       tmp1 = var0
TRACE:miri::interpreter 0                       tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                       if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                       // bb2
TRACE:miri::interpreter 0                       tmp5 = var0
TRACE:miri::interpreter 0                       tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                       tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                        // bb0
TRACE:miri::interpreter 0                        var0 = arg0
TRACE:miri::interpreter 0                        tmp1 = var0
TRACE:miri::interpreter 0                        tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                        if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                        // bb2
TRACE:miri::interpreter 0                        tmp5 = var0
TRACE:miri::interpreter 0                        tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                        tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                         // bb0
TRACE:miri::interpreter 0                         var0 = arg0
TRACE:miri::interpreter 0                         tmp1 = var0
TRACE:miri::interpreter 0                         tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                         if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                         // bb2
TRACE:miri::interpreter 0                         tmp5 = var0
TRACE:miri::interpreter 0                         tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                         tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                          // bb0
TRACE:miri::interpreter 0                          var0 = arg0
TRACE:miri::interpreter 0                          tmp1 = var0
TRACE:miri::interpreter 0                          tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                          if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                          // bb2
TRACE:miri::interpreter 0                          tmp5 = var0
TRACE:miri::interpreter 0                          tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                          tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                           // bb0
TRACE:miri::interpreter 0                           var0 = arg0
TRACE:miri::interpreter 0                           tmp1 = var0
TRACE:miri::interpreter 0                           tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                           if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                           // bb2
TRACE:miri::interpreter 0                           tmp5 = var0
TRACE:miri::interpreter 0                           tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                           tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                            // bb0
TRACE:miri::interpreter 0                            var0 = arg0
TRACE:miri::interpreter 0                            tmp1 = var0
TRACE:miri::interpreter 0                            tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                            if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                            // bb2
TRACE:miri::interpreter 0                            tmp5 = var0
TRACE:miri::interpreter 0                            tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                            tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                             // bb0
TRACE:miri::interpreter 0                             var0 = arg0
TRACE:miri::interpreter 0                             tmp1 = var0
TRACE:miri::interpreter 0                             tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                             if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                             // bb2
TRACE:miri::interpreter 0                             tmp5 = var0
TRACE:miri::interpreter 0                             tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                             tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                              // bb0
TRACE:miri::interpreter 0                              var0 = arg0
TRACE:miri::interpreter 0                              tmp1 = var0
TRACE:miri::interpreter 0                              tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                              if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                              // bb2
TRACE:miri::interpreter 0                              tmp5 = var0
TRACE:miri::interpreter 0                              tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                              tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                               // bb0
TRACE:miri::interpreter 0                               var0 = arg0
TRACE:miri::interpreter 0                               tmp1 = var0
TRACE:miri::interpreter 0                               tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                               if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                               // bb2
TRACE:miri::interpreter 0                               tmp5 = var0
TRACE:miri::interpreter 0                               tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                               tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                                // bb0
TRACE:miri::interpreter 0                                var0 = arg0
TRACE:miri::interpreter 0                                tmp1 = var0
TRACE:miri::interpreter 0                                tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                                if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                                // bb2
TRACE:miri::interpreter 0                                tmp5 = var0
TRACE:miri::interpreter 0                                tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                                tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                                 // bb0
TRACE:miri::interpreter 0                                 var0 = arg0
TRACE:miri::interpreter 0                                 tmp1 = var0
TRACE:miri::interpreter 0                                 tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                                 if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                                 // bb2
TRACE:miri::interpreter 0                                 tmp5 = var0
TRACE:miri::interpreter 0                                 tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                                 tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                                  // bb0
TRACE:miri::interpreter 0                                  var0 = arg0
TRACE:miri::interpreter 0                                  tmp1 = var0
TRACE:miri::interpreter 0                                  tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                                  if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                                  // bb2
TRACE:miri::interpreter 0                                  tmp5 = var0
TRACE:miri::interpreter 0                                  tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                                  tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                                   // bb0
TRACE:miri::interpreter 0                                   var0 = arg0
TRACE:miri::interpreter 0                                   tmp1 = var0
TRACE:miri::interpreter 0                                   tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                                   if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                                   // bb2
TRACE:miri::interpreter 0                                   tmp5 = var0
TRACE:miri::interpreter 0                                   tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                                   tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                                    // bb0
TRACE:miri::interpreter 0                                    var0 = arg0
TRACE:miri::interpreter 0                                    tmp1 = var0
TRACE:miri::interpreter 0                                    tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                                    if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                                    // bb2
TRACE:miri::interpreter 0                                    tmp5 = var0
TRACE:miri::interpreter 0                                    tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                                    tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                                     // bb0
TRACE:miri::interpreter 0                                     var0 = arg0
TRACE:miri::interpreter 0                                     tmp1 = var0
TRACE:miri::interpreter 0                                     tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                                     if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                                     // bb2
TRACE:miri::interpreter 0                                     tmp5 = var0
TRACE:miri::interpreter 0                                     tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                                     tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                                      // bb0
TRACE:miri::interpreter 0                                      var0 = arg0
TRACE:miri::interpreter 0                                      tmp1 = var0
TRACE:miri::interpreter 0                                      tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                                      if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                                      // bb2
TRACE:miri::interpreter 0                                      tmp5 = var0
TRACE:miri::interpreter 0                                      tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                                      tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                                       // bb0
TRACE:miri::interpreter 0                                       var0 = arg0
TRACE:miri::interpreter 0                                       tmp1 = var0
TRACE:miri::interpreter 0                                       tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                                       if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                                       // bb2
TRACE:miri::interpreter 0                                       tmp5 = var0
TRACE:miri::interpreter 0                                       tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                                       tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 0                                        // bb0
TRACE:miri::interpreter 0                                        var0 = arg0
TRACE:miri::interpreter 0                                        tmp1 = var0
TRACE:miri::interpreter 0                                        tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 0                                        if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 0                                        // bb2
TRACE:miri::interpreter 0                                        tmp5 = var0
TRACE:miri::interpreter 0                                        tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 0                                        tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 1 // bb0
TRACE:miri::interpreter 1 var0 = arg0
TRACE:miri::interpreter 1 tmp1 = var0
TRACE:miri::interpreter 1 tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 1 if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 1 // bb2
TRACE:miri::interpreter 1 tmp5 = var0
TRACE:miri::interpreter 1 tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 1 tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 1  // bb0
TRACE:miri::interpreter 1  var0 = arg0
TRACE:miri::interpreter 1  tmp1 = var0
TRACE:miri::interpreter 1  tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 1  if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 1  // bb2
TRACE:miri::interpreter 1  tmp5 = var0
TRACE:miri::interpreter 1  tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 1  tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 1   // bb0
TRACE:miri::interpreter 1   var0 = arg0
TRACE:miri::interpreter 1   tmp1 = var0
TRACE:miri::interpreter 1   tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 1   if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 1   // bb2
TRACE:miri::interpreter 1   tmp5 = var0
TRACE:miri::interpreter 1   tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 1   tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 1    // bb0
TRACE:miri::interpreter 1    var0 = arg0
TRACE:miri::interpreter 1    tmp1 = var0
TRACE:miri::interpreter 1    tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 1    if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 1    // bb2
TRACE:miri::interpreter 1    tmp5 = var0
TRACE:miri::interpreter 1    tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 1    tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 1     // bb0
TRACE:miri::interpreter 1     var0 = arg0
TRACE:miri::interpreter 1     tmp1 = var0
TRACE:miri::interpreter 1     tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 1     if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 1     // bb2
TRACE:miri::interpreter 1     tmp5 = var0
TRACE:miri::interpreter 1     tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 1     tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 1      // bb0
TRACE:miri::interpreter 1      var0 = arg0
TRACE:miri::interpreter 1      tmp1 = var0
TRACE:miri::interpreter 1      tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 1      if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 1      // bb2
TRACE:miri::interpreter 1      tmp5 = var0
TRACE:miri::interpreter 1      tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 1      tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 1       // bb0
TRACE:miri::interpreter 1       var0 = arg0
TRACE:miri::interpreter 1       tmp1 = var0
TRACE:miri::interpreter 1       tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 1       if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 1       // bb2
TRACE:miri::interpreter 1       tmp5 = var0
TRACE:miri::interpreter 1       tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 1       tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 1        // bb0
TRACE:miri::interpreter 1        var0 = arg0
TRACE:miri::interpreter 1        tmp1 = var0
TRACE:miri::interpreter 1        tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 1        if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 1        // bb2
TRACE:miri::interpreter 1        tmp5 = var0
TRACE:miri::interpreter 1        tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 1        tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 1         // bb0
TRACE:miri::interpreter 1         var0 = arg0
TRACE:miri::interpreter 1         tmp1 = var0
TRACE:miri::interpreter 1         tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 1         if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 1         // bb2
TRACE:miri::interpreter 1         tmp5 = var0
TRACE:miri::interpreter 1         tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 1         tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 1          // bb0
TRACE:miri::interpreter 1          var0 = arg0
TRACE:miri::interpreter 1          tmp1 = var0
TRACE:miri::interpreter 1          tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 1          if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 1          // bb2
TRACE:miri::interpreter 1          tmp5 = var0
TRACE:miri::interpreter 1          tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 1          tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 1           // bb0
TRACE:miri::interpreter 1           var0 = arg0
TRACE:miri::interpreter 1           tmp1 = var0
TRACE:miri::interpreter 1           tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 1           if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 1           // bb2
TRACE:miri::interpreter 1           tmp5 = var0
TRACE:miri::interpreter 1           tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 1           tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 1            // bb0
TRACE:miri::interpreter 1            var0 = arg0
TRACE:miri::interpreter 1            tmp1 = var0
TRACE:miri::interpreter 1            tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 1            if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 1            // bb2
TRACE:miri::interpreter 1            tmp5 = var0
TRACE:miri::interpreter 1            tmp4 = Add(tmp5, const 1i32)
TRACE:miri::interpreter 1            tmp3 = cake::foo(tmp4) -> bb4
TRACE:miri::interpreter 1             // bb0
TRACE:miri::interpreter 1             var0 = arg0
TRACE:miri::interpreter 1             tmp1 = var0
TRACE:miri::interpreter 1             tmp0 = Eq(tmp1, const 50i32)
TRACE:miri::interpreter 1             if(tmp0) -> [true: bb1, false: bb2]
TRACE:miri::interpreter 1             // bb1
TRACE:miri::interpreter 1             tmp2 = undefined_byte_read() -> bb3
TRACE:miri::interpreter 1              // bb0
TRACE:miri::interpreter 1              var0 = <std::vec::Vec<T>><u8>::with_capacity(const 10usize) -> [return: bb3, unwind: bb2]
TRACE:miri::interpreter 1               // bb0
TRACE:miri::interpreter 1               var0 = arg0
TRACE:miri::interpreter 1               tmp1 = var0
TRACE:miri::interpreter 1               tmp0 = <alloc::raw_vec::RawVec<T>><T>::with_capacity(tmp1) -> bb1
TRACE:miri::interpreter 1                // bb0
TRACE:miri::interpreter 1                var0 = arg0
TRACE:miri::interpreter 1                var1 = std::mem::size_of::<T>() -> bb1
TRACE:miri::interpreter 1                 // bb0
TRACE:miri::interpreter 1                 return = std::intrinsics::::size_of::<T>() -> bb1
TRACE:miri::interpreter 1                 // bb1
TRACE:miri::interpreter 1                 return
TRACE:miri::interpreter 1                // bb1
TRACE:miri::interpreter 1                tmp1 = var0
TRACE:miri::interpreter 1                tmp2 = var1
TRACE:miri::interpreter 1                tmp0 = core::num::<impl usize>::checked_mul(tmp1, tmp2) -> bb2
TRACE:miri::interpreter 1                 // bb0
TRACE:miri::interpreter 1                 var0 = arg0
TRACE:miri::interpreter 1                 var1 = arg1
TRACE:miri::interpreter 1                 tmp1 = var0
TRACE:miri::interpreter 1                 tmp2 = var1
TRACE:miri::interpreter 1                 tmp0 = core::num::<impl usize>::overflowing_mul(tmp1, tmp2) -> bb1
TRACE:miri::interpreter 1                  // bb0
TRACE:miri::interpreter 1                  var0 = arg0
TRACE:miri::interpreter 1                  var1 = arg1
TRACE:miri::interpreter 1                  tmp2 = var0
TRACE:miri::interpreter 1                  tmp1 = tmp2 as u64 (Misc)
TRACE:miri::interpreter 1                  tmp4 = var1
TRACE:miri::interpreter 1                  tmp3 = tmp4 as u64 (Misc)
TRACE:miri::interpreter 1                  tmp0 = std::intrinsics::::mul_with_overflow::<u64>(tmp1, tmp3) -> bb1
TRACE:miri::interpreter 1                  // bb1
TRACE:miri::interpreter 1                  var2 = (tmp0.0: u64)
TRACE:miri::interpreter 1                  var3 = (tmp0.1: bool)
TRACE:miri::interpreter 1                  tmp6 = var2
TRACE:miri::interpreter 1                  tmp5 = tmp6 as usize (Misc)
TRACE:miri::interpreter 1                  tmp7 = var3
TRACE:miri::interpreter 1                  return = (tmp5, tmp7)
TRACE:miri::interpreter 1                  return
TRACE:miri::interpreter 1                 // bb1
TRACE:miri::interpreter 1                 var2 = (tmp0.0: usize)
TRACE:miri::interpreter 1                 var3 = (tmp0.1: bool)
TRACE:miri::interpreter 1                 tmp3 = var3
TRACE:miri::interpreter 1                 if(tmp3) -> [true: bb2, false: bb3]
TRACE:miri::interpreter 1                 // bb3
TRACE:miri::interpreter 1                 tmp4 = var2
TRACE:miri::interpreter 1                 return = std::prelude::v1::Some<usize>(tmp4,)
TRACE:miri::interpreter 1                 goto -> bb4
TRACE:miri::interpreter 1                 // bb4
TRACE:miri::interpreter 1                 return
TRACE:miri::interpreter 1                // bb2
TRACE:miri::interpreter 1                tmp4 = const "capacity overflow"
TRACE:miri::interpreter 1                tmp3 = &(*tmp4)
TRACE:miri::interpreter 1                var2 = <std::option::Option<T>><usize>::expect(tmp0, tmp3) -> bb3
TRACE:miri::interpreter 1                 // bb0
TRACE:miri::interpreter 1                 var0 = arg0
TRACE:miri::interpreter 1                 var1 = arg1
TRACE:miri::interpreter 1                 switch(var0) -> [None: bb4, Some: bb5]
TRACE:miri::interpreter 1                 // bb5
TRACE:miri::interpreter 1                 var2 = ((var0 as Some).0: T)
TRACE:miri::interpreter 1                 tmp1 = var2
TRACE:miri::interpreter 1                 return = tmp1
TRACE:miri::interpreter 1                 drop(var2) -> [return: bb6, unwind: bb12]
DEBUG:miri::interpreter 1                 no need to drop usize
TRACE:miri::interpreter 1                 // bb6
TRACE:miri::interpreter 1                 drop(tmp1) -> [return: bb8, unwind: bb13]
DEBUG:miri::interpreter 1                 no need to drop usize
TRACE:miri::interpreter 1                 // bb8
TRACE:miri::interpreter 1                 drop(arg0) -> [return: bb9, unwind: bb14]
DEBUG:miri::interpreter 1                 no need to drop std::option::Option<usize>
TRACE:miri::interpreter 1                 // bb9
TRACE:miri::interpreter 1                 drop(var0) -> bb10
DEBUG:miri::interpreter 1                 no need to drop std::option::Option<usize>
TRACE:miri::interpreter 1                 // bb10
TRACE:miri::interpreter 1                 return
TRACE:miri::interpreter 1                // bb3
TRACE:miri::interpreter 1                tmp6 = var2
TRACE:miri::interpreter 1                tmp5 = alloc::raw_vec::alloc_guard(tmp6) -> bb4
TRACE:miri::interpreter 1                 // bb0
TRACE:miri::interpreter 1                 var0 = arg0
TRACE:miri::interpreter 1                 tmp1 = std::mem::size_of::<usize>() -> bb1
TRACE:miri::interpreter 1                  // bb0
TRACE:miri::interpreter 1                  return = std::intrinsics::::size_of::<T>() -> bb1
TRACE:miri::interpreter 1                  // bb1
TRACE:miri::interpreter 1                  return
TRACE:miri::interpreter 1                 // bb1
TRACE:miri::interpreter 1                 tmp0 = Lt(tmp1, const 8usize)
TRACE:miri::interpreter 1                 if(tmp0) -> [true: bb2, false: bb3]
TRACE:miri::interpreter 1                 // bb3
TRACE:miri::interpreter 1                 return = ()
TRACE:miri::interpreter 1                 goto -> bb6
TRACE:miri::interpreter 1                 // bb6
TRACE:miri::interpreter 1                 return
TRACE:miri::interpreter 1                // bb4
TRACE:miri::interpreter 1                tmp8 = var2
TRACE:miri::interpreter 1                tmp7 = Eq(tmp8, const 0usize)
TRACE:miri::interpreter 1                if(tmp7) -> [true: bb5, false: bb6]
TRACE:miri::interpreter 1                // bb6
TRACE:miri::interpreter 1                var4 = std::mem::align_of::<T>() -> bb7
TRACE:miri::interpreter 1                 // bb0
TRACE:miri::interpreter 1                 return = std::intrinsics::::min_align_of::<T>() -> bb1
TRACE:miri::interpreter 1                 // bb1
TRACE:miri::interpreter 1                 return
TRACE:miri::interpreter 1                // bb7
TRACE:miri::interpreter 1                tmp9 = var2
TRACE:miri::interpreter 1                tmp10 = var4
TRACE:miri::interpreter 1                var5 = alloc::heap::allocate(tmp9, tmp10) -> bb8
TRACE:miri::interpreter 1                 // bb0
TRACE:miri::interpreter 1                 var0 = arg0
TRACE:miri::interpreter 1                 var1 = arg1
TRACE:miri::interpreter 1                 tmp1 = var0
TRACE:miri::interpreter 1                 tmp2 = var1
TRACE:miri::interpreter 1                 tmp0 = alloc::heap::check_size_and_alignment(tmp1, tmp2) -> bb1
TRACE:miri::interpreter 1                  // bb0
TRACE:miri::interpreter 1                  var0 = arg0
TRACE:miri::interpreter 1                  var1 = arg1
TRACE:miri::interpreter 1                  tmp0 = ()
TRACE:miri::interpreter 1                  goto -> bb1
TRACE:miri::interpreter 1                  // bb1
TRACE:miri::interpreter 1                  tmp7 = ()
TRACE:miri::interpreter 1                  goto -> bb2
TRACE:miri::interpreter 1                  // bb2
TRACE:miri::interpreter 1                  tmp26 = ()
TRACE:miri::interpreter 1                  return = ()
TRACE:miri::interpreter 1                  return
TRACE:miri::interpreter 1                 // bb1
TRACE:miri::interpreter 1                 tmp3 = var0
TRACE:miri::interpreter 1                 tmp4 = var1
TRACE:miri::interpreter 1                 return = alloc::heap::::__rust_allocate(tmp3, tmp4) -> bb2
TRACE:miri::interpreter 1                 // bb2
TRACE:miri::interpreter 1                 return
TRACE:miri::interpreter 1                // bb8
TRACE:miri::interpreter 1                tmp13 = var5
TRACE:miri::interpreter 1                tmp12 = std::ptr::<impl *mut T><u8>::is_null(tmp13) -> bb9
TRACE:miri::interpreter 1                 // bb0
TRACE:miri::interpreter 1                 var0 = arg0
TRACE:miri::interpreter 1                 tmp0 = var0
TRACE:miri::interpreter 1                 tmp1 = std::ptr::null_mut::<T>() -> bb1
TRACE:miri::interpreter 1                  // bb0
TRACE:miri::interpreter 1                  return = const 0usize as *mut T (Misc)
TRACE:miri::interpreter 1                  return
TRACE:miri::interpreter 1                 // bb1
TRACE:miri::interpreter 1                 return = Eq(tmp0, tmp1)
TRACE:miri::interpreter 1                 return
TRACE:miri::interpreter 1                // bb9
TRACE:miri::interpreter 1                if(tmp12) -> [true: bb10, false: bb11]
TRACE:miri::interpreter 1                // bb11
TRACE:miri::interpreter 1                tmp11 = ()
TRACE:miri::interpreter 1                tmp14 = var5
TRACE:miri::interpreter 1                var3 = tmp14
TRACE:miri::interpreter 1                goto -> bb12
TRACE:miri::interpreter 1                // bb12
TRACE:miri::interpreter 1                tmp17 = var3
TRACE:miri::interpreter 1                tmp16 = tmp17 as *mut T (Misc)
TRACE:miri::interpreter 1                tmp15 = <std::ptr::Unique<T>><T>::new(tmp16) -> bb13
TRACE:miri::interpreter 1                 // bb0
TRACE:miri::interpreter 1                 var0 = arg0
TRACE:miri::interpreter 1                 tmp2 = var0
TRACE:miri::interpreter 1                 tmp1 = tmp2 as *const T (Misc)
TRACE:miri::interpreter 1                 tmp0 = <core::nonzero::NonZero<T>><*const T>::new(tmp1) -> bb1
TRACE:miri::interpreter 1                  // bb0
TRACE:miri::interpreter 1                  var0 = arg0
TRACE:miri::interpreter 1                  tmp0 = var0
TRACE:miri::interpreter 1                  return = core::nonzero::NonZero::{{constructor}}<T>(tmp0,)
TRACE:miri::interpreter 1                  drop(tmp0) -> [return: bb4, unwind: bb3]
DEBUG:miri::interpreter 1                  no need to drop *const u8
TRACE:miri::interpreter 1                  // bb4
TRACE:miri::interpreter 1                  drop(arg0) -> [return: bb5, unwind: bb7]
DEBUG:miri::interpreter 1                  no need to drop *const u8
TRACE:miri::interpreter 1                  // bb5
TRACE:miri::interpreter 1                  drop(var0) -> bb6
DEBUG:miri::interpreter 1                  no need to drop *const u8
TRACE:miri::interpreter 1                  // bb6
TRACE:miri::interpreter 1                  return
TRACE:miri::interpreter 1                 // bb1
TRACE:miri::interpreter 1                 tmp3 = std::marker::PhantomData::{{constructor}}<T>
TRACE:miri::interpreter 1                 return = std::ptr::Unique<T> { pointer: tmp0, _marker: tmp3 }
TRACE:miri::interpreter 1                 return
TRACE:miri::interpreter 1                // bb13
TRACE:miri::interpreter 1                tmp18 = var0
TRACE:miri::interpreter 1                return = alloc::raw_vec::RawVec<T> { ptr: tmp15, cap: tmp18 }
TRACE:miri::interpreter 1                return
TRACE:miri::interpreter 1               // bb1
TRACE:miri::interpreter 1               return = std::vec::Vec<T> { buf: tmp0, len: const 0usize }
TRACE:miri::interpreter 1               drop(tmp0) -> bb2
TRACE:miri::interpreter 1               -need to drop alloc::raw_vec::RawVec<u8>
TRACE:miri::interpreter 1               // bb2
TRACE:miri::interpreter 1               return
TRACE:miri::interpreter 1              // bb3
TRACE:miri::interpreter 1              tmp5 = &var0
TRACE:miri::interpreter 1              tmp4 = <std::vec::Vec<u8> as std::ops::Deref>::deref(tmp5) -> [return: bb4, unwind: bb2]
TRACE:miri::interpreter 1               // bb0
TRACE:miri::interpreter 1               var0 = arg0
TRACE:miri::interpreter 1               tmp0 = &((*var0).0: alloc::raw_vec::RawVec<T>)
TRACE:miri::interpreter 1               var1 = <alloc::raw_vec::RawVec<T>><T>::ptr(tmp0) -> bb1
TRACE:miri::interpreter 1                // bb0
TRACE:miri::interpreter 1                var0 = arg0
TRACE:miri::interpreter 1                tmp2 = &((*var0).0: std::ptr::Unique<T>)
TRACE:miri::interpreter 1                tmp1 = <std::ptr::Unique<T> as std::ops::Deref>::deref(tmp2) -> bb1
TRACE:miri::interpreter 1                 // bb0
TRACE:miri::interpreter 1                 var0 = arg0
TRACE:miri::interpreter 1                 tmp2 = &((*var0).0: core::nonzero::NonZero<*const T>)
TRACE:miri::interpreter 1                 tmp1 = <core::nonzero::NonZero<*const T> as std::ops::Deref>::deref(tmp2) -> bb1
TRACE:miri::interpreter 1                  // bb0
TRACE:miri::interpreter 1                  var0 = arg0
TRACE:miri::interpreter 1                  var1 = &((*var0).0: T)
TRACE:miri::interpreter 1                  return = &(*var1)
TRACE:miri::interpreter 1                  return
TRACE:miri::interpreter 1                 // bb1
TRACE:miri::interpreter 1                 tmp0 = &(*tmp1)
TRACE:miri::interpreter 1                 return = std::mem::transmute::<&'static *const T, &'static *mut T>(tmp0) -> bb2
TRACE:miri::interpreter 1                 // bb2
TRACE:miri::interpreter 1                 return
TRACE:miri::interpreter 1                // bb1
TRACE:miri::interpreter 1                tmp0 = (*tmp1)
TRACE:miri::interpreter 1                return = tmp0
TRACE:miri::interpreter 1                return
TRACE:miri::interpreter 1               // bb1
TRACE:miri::interpreter 1               tmp4 = var1
TRACE:miri::interpreter 1               tmp3 = std::ptr::<impl *mut T><T>::is_null(tmp4) -> bb2
TRACE:miri::interpreter 1                // bb0
TRACE:miri::interpreter 1                var0 = arg0
TRACE:miri::interpreter 1                tmp0 = var0
TRACE:miri::interpreter 1                tmp1 = std::ptr::null_mut::<T>() -> bb1
TRACE:miri::interpreter 1                 // bb0
TRACE:miri::interpreter 1                 return = const 0usize as *mut T (Misc)
TRACE:miri::interpreter 1                 return
TRACE:miri::interpreter 1                // bb1
TRACE:miri::interpreter 1                return = Eq(tmp0, tmp1)
TRACE:miri::interpreter 1                return
TRACE:miri::interpreter 1               // bb2
TRACE:miri::interpreter 1               tmp2 = Not(tmp3)
TRACE:miri::interpreter 1               tmp1 = std::intrinsics::::assume(tmp2) -> bb3
TRACE:miri::interpreter 1               // bb3
TRACE:miri::interpreter 1               tmp7 = var1
TRACE:miri::interpreter 1               tmp6 = tmp7 as *const T (Misc)
TRACE:miri::interpreter 1               tmp8 = ((*var0).1: usize)
TRACE:miri::interpreter 1               tmp5 = std::slice::from_raw_parts::<T>(tmp6, tmp8) -> bb4
TRACE:miri::interpreter 1                // bb0
TRACE:miri::interpreter 1                var0 = arg0
TRACE:miri::interpreter 1                var1 = arg1
TRACE:miri::interpreter 1                tmp1 = var0
TRACE:miri::interpreter 1                tmp2 = var1
TRACE:miri::interpreter 1                tmp0 = core::slice::Repr<T> { data: tmp1, len: tmp2 }
TRACE:miri::interpreter 1                return = std::mem::transmute::<core::slice::Repr<T>, &'static [T]>(tmp0) -> bb1
TRACE:miri::interpreter 1                // bb1
TRACE:miri::interpreter 1                return
TRACE:miri::interpreter 1               // bb4
TRACE:miri::interpreter 1               return = &(*tmp5)
TRACE:miri::interpreter 1               return
TRACE:miri::interpreter 1              // bb4
TRACE:miri::interpreter 1              tmp3 = &(*tmp4)
TRACE:miri::interpreter 1              tmp2 = std::slice::<impl [T]><u8>::get_unchecked(tmp3, const 5usize) -> [return: bb5, unwind: bb2]
TRACE:miri::interpreter 1               // bb0
TRACE:miri::interpreter 1               var0 = arg0
TRACE:miri::interpreter 1               var1 = arg1
TRACE:miri::interpreter 1               tmp1 = &(*var0)
TRACE:miri::interpreter 1               tmp2 = var1
TRACE:miri::interpreter 1               tmp0 = <[T] as core::slice::SliceExt>::get_unchecked(tmp1, tmp2) -> bb1
TRACE:miri::interpreter 1                // bb0
TRACE:miri::interpreter 1                var0 = arg0
TRACE:miri::interpreter 1                var1 = arg1
TRACE:miri::interpreter 1                tmp3 = &(*var0)
TRACE:miri::interpreter 1                tmp2 = <[T] as core::slice::SliceExt>::as_ptr(tmp3) -> bb1
TRACE:miri::interpreter 1                 // bb0
TRACE:miri::interpreter 1                 var0 = arg0
TRACE:miri::interpreter 1                 tmp1 = &(*var0)
TRACE:miri::interpreter 1                 tmp0 = tmp1 as *const [T] (Misc)
TRACE:miri::interpreter 1                 return = tmp0 as *const T (Misc)
TRACE:miri::interpreter 1                 return
TRACE:miri::interpreter 1                // bb1
TRACE:miri::interpreter 1                tmp5 = var1
TRACE:miri::interpreter 1                tmp4 = tmp5 as isize (Misc)
TRACE:miri::interpreter 1                tmp1 = std::ptr::<impl *const T><T>::offset(tmp2, tmp4) -> bb2
TRACE:miri::interpreter 1                 // bb0
TRACE:miri::interpreter 1                 var0 = arg0
TRACE:miri::interpreter 1                 var1 = arg1
TRACE:miri::interpreter 1                 tmp0 = var0
TRACE:miri::interpreter 1                 tmp1 = var1
TRACE:miri::interpreter 1                 return = std::intrinsics::::offset::<T>(tmp0, tmp1) -> bb1
TRACE:miri::interpreter 1                 // bb1
TRACE:miri::interpreter 1                 return
TRACE:miri::interpreter 1                // bb2
TRACE:miri::interpreter 1                tmp0 = &(*tmp1)
TRACE:miri::interpreter 1                return = &(*tmp0)
TRACE:miri::interpreter 1                return
TRACE:miri::interpreter 1               // bb1
TRACE:miri::interpreter 1               return = &(*tmp0)
TRACE:miri::interpreter 1               return
TRACE:miri::interpreter 1              // bb5
TRACE:miri::interpreter 1              tmp1 = (*tmp2)
TRACE:miri::interpreter 1              var1 = tmp1
TRACE:miri::interpreter 1              tmp6 = var1
TRACE:miri::interpreter 1              return = Add(tmp6, const 1u8)
tests/compile-fail/errors.rs:33:5: 33:14 error: attempted to read undefined bytes
tests/compile-fail/errors.rs:33     undef + 1 //~ ERROR: attempted to read undefined bytes
                                    ^~~~~~~~~
tests/compile-fail/errors.rs:46:21: 46:42 note: inside call to undefined_byte_read
tests/compile-fail/errors.rs:46             let _ = undefined_byte_read();
                                                    ^~~~~~~~~~~~~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:48:13: 48:23 note: inside call to cake::foo
tests/compile-fail/errors.rs:48             foo(i + 1);
                                            ^~~~~~~~~~
tests/compile-fail/errors.rs:51:5: 51:11 note: inside call to cake::foo
tests/compile-fail/errors.rs:51     foo(0);
                                    ^~~~~~

@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 1, 2016

removed the indentation string and used format now.

const NSPACES: usize = 40;
let format = |record: &log::LogRecord| {
// prepend spaces to indent the final string
let indentation = log_settings::settings().indentation;
Copy link
Member

@solson solson Jun 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename this to indent_amount or something so the indentation later doesn't use the same name?

EDIT: Err, they're both indentation amounts... scratch that. I guess you could move % NSPACES into the format call and remove the shadowing variable.

@solson solson merged commit 66a812f into rust-lang:master Jun 1, 2016
@solson
Copy link
Member

solson commented Jun 1, 2016

Thanks! Glad to see my TRACE_EXECUTION hack finally dead.

@oli-obk oli-obk deleted the logs branch June 1, 2016 16:48
github-actions bot pushed a commit that referenced this pull request Dec 8, 2023
Change prefetch to avoid deadlock

Was abled to reproduce the deadlock in #118205 and created a coredump when it happen. When looking at the backtraces  I noticed that the prefetch of exported_symbols (Thread 17 frame 4) started after the "actual" exported_symbols (Thread 2 frame 18) but it also is working on some of the collect_crate_mono_items (Thread 17 frame12 ) that Thread 2 is blocked on resulting in a deadlock.

This PR results in less parallell work that can be done at the same time but from what I can find we do not call the query exported_symbols from multiple places in the same join call any more.

```
Thread 17 (Thread 0x7f87b6299700 (LWP 11370)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f87be5166a9 in <parking_lot::condvar::Condvar>::wait_until_internal () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#2  0x00007f87be12d854 in <rustc_query_system::query::job::QueryLatch>::wait_on () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#3  0x00007f87bd27d16f in rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::CrateNum, rustc_middle::query::erase::Erased<[u8; 16]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#4  0x00007f87bd0b5b6a in rustc_query_impl::query_impl::exported_symbols::get_query_non_incr::__rust_end_short_backtrace () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#5  0x00007f87bdaebb0a in rustc_metadata::rmeta::encoder::encode_metadata::{closure#1}::{closure#1} () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#6  0x00007f87bdae1509 in rayon_core::join::join_context::call_b::<core::option::Option<rustc_data_structures::marker::FromDyn<&[(rustc_middle::middle::exported_symbols::ExportedSymbol, rustc_middle::middle::exported_symbols::SymbolExportInfo)]>>, rayon_core::join::join::call<core::option::Option<rustc_data_structures::marker::FromDyn<&[(rustc_middle::middle::exported_symbols::ExportedSymbol, rustc_middle::middle::exported_symbols::SymbolExportInfo)]>>, rustc_data_structures::sync::parallel::enabled::join<rustc_metadata::rmeta::encoder::encode_metadata::{closure#1}::{closure#0}, rustc_metadata::rmeta::encoder::encode_metadata::{closure#1}::{closure#1}, (), &[(rustc_middle::middle::exported_symbols::ExportedSymbol, rustc_middle::middle::exported_symbols::SymbolExportInfo)]>::{closure#0}::{closure#1}>::{closure#0}>::{closure#0} () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#7  0x00007f87bdae32ff in <rayon_core::job::StackJob<rayon_core::latch::SpinLatch, rayon_core::join::join_context::call_b<core::option::Option<rustc_data_structures::marker::FromDyn<&[(rustc_middle::middle::exported_symbols::ExportedSymbol, rustc_middle::middle::exported_symbols::SymbolExportInfo)]>>, rayon_core::join::join::call<core::option::Option<rustc_data_structures::marker::FromDyn<&[(rustc_middle::middle::exported_symbols::ExportedSymbol, rustc_middle::middle::exported_symbols::SymbolExportInfo)]>>, rustc_data_structures::sync::parallel::enabled::join<rustc_metadata::rmeta::encoder::encode_metadata::{closure#1}::{closure#0}, rustc_metadata::rmeta::encoder::encode_metadata::{closure#1}::{closure#1}, (), &[(rustc_middle::middle::exported_symbols::ExportedSymbol, rustc_middle::middle::exported_symbols::SymbolExportInfo)]>::{closure#0}::{closure#1}>::{closure#0}>::{closure#0}, core::option::Option<rustc_data_structures::marker::FromDyn<&[(rustc_middle::middle::exported_symbols::ExportedSymbol, rustc_middle::middle::exported_symbols::SymbolExportInfo)]>>> as rayon_core::job::Job>::execute () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#8  0x00007f87b8338823 in <rayon_core::registry::WorkerThread>::wait_until_cold () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#9  0x00007f87bc2edbaf in rayon_core::join::join_context::<rayon::iter::plumbing::bridge_producer_consumer::helper<rayon::vec::DrainProducer<rustc_middle::mir::mono::MonoItem>, rayon::iter::for_each::ForEachConsumer<rustc_data_structures::sync::parallel::enabled::par_for_each_in<rustc_middle::mir::mono::MonoItem, alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}>>::{closure#0}, rayon::iter::plumbing::bridge_producer_consumer::helper<rayon::vec::DrainProducer<rustc_middle::mir::mono::MonoItem>, rayon::iter::for_each::ForEachConsumer<rustc_data_structures::sync::parallel::enabled::par_for_each_in<rustc_middle::mir::mono::MonoItem, alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}>>::{closure#1}, (), ()>::{closure#0} () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#10 0x00007f87bc2ed313 in rayon_core::registry::in_worker::<rayon_core::join::join_context<rayon::iter::plumbing::bridge_producer_consumer::helper<rayon::vec::DrainProducer<rustc_middle::mir::mono::MonoItem>, rayon::iter::for_each::ForEachConsumer<rustc_data_structures::sync::parallel::enabled::par_for_each_in<rustc_middle::mir::mono::MonoItem, alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}>>::{closure#0}, rayon::iter::plumbing::bridge_producer_consumer::helper<rayon::vec::DrainProducer<rustc_middle::mir::mono::MonoItem>, rayon::iter::for_each::ForEachConsumer<rustc_data_structures::sync::parallel::enabled::par_for_each_in<rustc_middle::mir::mono::MonoItem, alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}>>::{closure#1}, (), ()>::{closure#0}, ((), ())> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#11 0x00007f87bc2db2a4 in rayon::iter::plumbing::bridge_producer_consumer::helper::<rayon::vec::DrainProducer<rustc_middle::mir::mono::MonoItem>, rayon::iter::for_each::ForEachConsumer<rustc_data_structures::sync::parallel::enabled::par_for_each_in<rustc_middle::mir::mono::MonoItem, alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}>> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#12 0x00007f87bc2eead2 in <rayon_core::job::StackJob<rayon_core::latch::SpinLatch, rayon_core::join::join_context::call_b<(), rayon::iter::plumbing::bridge_producer_consumer::helper<rayon::vec::DrainProducer<rustc_middle::mir::mono::MonoItem>, rayon::iter::for_each::ForEachConsumer<rustc_data_structures::sync::parallel::enabled::par_for_each_in<rustc_middle::mir::mono::MonoItem, alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}>>::{closure#1}>::{closure#0}, ()> as rayon_core::job::Job>::execute () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#13 0x00007f87b8338823 in <rayon_core::registry::WorkerThread>::wait_until_cold () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#14 0x00007f87be52d1f9 in <rayon_core::registry::ThreadBuilder>::run () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#15 0x00007f87b8461c57 in <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#3}::{closure#0}::{closure#0}::{closure#0}, ()> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#16 0x00007f87b846e465 in rustc_span::set_session_globals_then::<(), rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#3}::{closure#0}::{closure#0}::{closure#0}> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#17 0x00007f87b844f282 in <<crossbeam_utils::thread::ScopedThreadBuilder>::spawn<<rayon_core::ThreadPoolBuilder>::build_scoped<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#3}::{closure#0}::{closure#0}, rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#3}::{closure#0}::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#0} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#18 0x00007f87b846af58 in <<std::thread::Builder>::spawn_unchecked_<alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output = ()> + core::marker::Send>, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#19 0x00007f87b7898e85 in std::sys::unix::thread::Thread::new::thread_start () from /home/andjo403/.rustup/toolchains/stage1/lib/libstd-d570b0650d35d951.so
#20 0x00007f87b7615609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#21 0x00007f87b7755133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7f87b729b700 (LWP 11368)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f87b7887b51 in std::sys::unix::locks::futex_condvar::Condvar::wait () from /home/andjo403/.rustup/toolchains/stage1/lib/libstd-d570b0650d35d951.so
#2  0x00007f87b8339478 in <rayon_core::sleep::Sleep>::sleep () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#3  0x00007f87b83387c3 in <rayon_core::registry::WorkerThread>::wait_until_cold () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#4  0x00007f87bc2edbaf in rayon_core::join::join_context::<rayon::iter::plumbing::bridge_producer_consumer::helper<rayon::vec::DrainProducer<rustc_middle::mir::mono::MonoItem>, rayon::iter::for_each::ForEachConsumer<rustc_data_structures::sync::parallel::enabled::par_for_each_in<rustc_middle::mir::mono::MonoItem, alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}>>::{closure#0}, rayon::iter::plumbing::bridge_producer_consumer::helper<rayon::vec::DrainProducer<rustc_middle::mir::mono::MonoItem>, rayon::iter::for_each::ForEachConsumer<rustc_data_structures::sync::parallel::enabled::par_for_each_in<rustc_middle::mir::mono::MonoItem, alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}>>::{closure#1}, (), ()>::{closure#0} () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#5  0x00007f87bc2ed313 in rayon_core::registry::in_worker::<rayon_core::join::join_context<rayon::iter::plumbing::bridge_producer_consumer::helper<rayon::vec::DrainProducer<rustc_middle::mir::mono::MonoItem>, rayon::iter::for_each::ForEachConsumer<rustc_data_structures::sync::parallel::enabled::par_for_each_in<rustc_middle::mir::mono::MonoItem, alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}>>::{closure#0}, rayon::iter::plumbing::bridge_producer_consumer::helper<rayon::vec::DrainProducer<rustc_middle::mir::mono::MonoItem>, rayon::iter::for_each::ForEachConsumer<rustc_data_structures::sync::parallel::enabled::par_for_each_in<rustc_middle::mir::mono::MonoItem, alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}>>::{closure#1}, (), ()>::{closure#0}, ((), ())> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#6  0x00007f87bc2db50c in <rayon::vec::IntoIter<rustc_middle::mir::mono::MonoItem> as rayon::iter::ParallelIterator>::for_each::<rustc_data_structures::sync::parallel::enabled::par_for_each_in<rustc_middle::mir::mono::MonoItem, alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#7  0x00007f87bc2e8cd7 in <rustc_session::session::Session>::time::<(), rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#8  0x00007f87bc2b8f2c in rustc_monomorphize::collector::collect_crate_mono_items () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#9  0x00007f87bc2c30d9 in rustc_monomorphize::partitioning::collect_and_partition_mono_items () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#10 0x00007f87bcf2cde6 in rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 24]>> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#11 0x00007f87bd156a3c in <rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#12 0x00007f87bd1c6a7d in rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 24]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#13 0x00007f87bd15df40 in rustc_query_impl::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#14 0x00007f87bd7a0ad9 in rustc_codegen_ssa::back::symbol_export::exported_symbols_provider_local () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#15 0x00007f87bcf29acb in rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::exported_symbols::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 16]>> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#16 0x00007f87bcfdb350 in <rustc_query_impl::query_impl::exported_symbols::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::CrateNum)>>::call_once () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#17 0x00007f87bd27d64f in rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::CrateNum, rustc_middle::query::erase::Erased<[u8; 16]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#18 0x00007f87bd0b5b6a in rustc_query_impl::query_impl::exported_symbols::get_query_non_incr::__rust_end_short_backtrace () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#19 0x00007f87bda927ce in rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::VecCache<rustc_span::def_id::CrateNum, rustc_middle::query::erase::Erased<[u8; 16]>>> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#20 0x00007f87bda9c93f in <rustc_metadata::rmeta::encoder::EncodeContext>::encode_crate_root () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#21 0x00007f87bdaa6ef7 in rustc_metadata::rmeta::encoder::encode_metadata_impl () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#22 0x00007f87bdae0b77 in rayon_core::join::join_context::<rayon_core::join::join::call<core::option::Option<rustc_data_structures::marker::FromDyn<()>>, rustc_data_structures::sync::parallel::enabled::join<rustc_metadata::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata::rmeta::encoder::encode_metadata::{closure#1}, (), ()>::{closure#0}::{closure#0}>::{closure#0}, rayon_core::join::join::call<core::option::Option<rustc_data_structures::marker::FromDyn<()>>, rustc_data_structures::sync::parallel::enabled::join<rustc_metadata::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata::rmeta::encoder::encode_metadata::{closure#1}, (), ()>::{closure#0}::{closure#1}>::{closure#0}, core::option::Option<rustc_data_structures::marker::FromDyn<()>>, core::option::Option<rustc_data_structures::marker::FromDyn<()>>>::{closure#0} () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#23 0x00007f87bdaded2f in rayon_core::registry::in_worker::<rayon_core::join::join_context<rayon_core::join::join::call<core::option::Option<rustc_data_structures::marker::FromDyn<()>>, rustc_data_structures::sync::parallel::enabled::join<rustc_metadata::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata::rmeta::encoder::encode_metadata::{closure#1}, (), ()>::{closure#0}::{closure#0}>::{closure#0}, rayon_core::join::join::call<core::option::Option<rustc_data_structures::marker::FromDyn<()>>, rustc_data_structures::sync::parallel::enabled::join<rustc_metadata::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata::rmeta::encoder::encode_metadata::{closure#1}, (), ()>::{closure#0}::{closure#1}>::{closure#0}, core::option::Option<rustc_data_structures::marker::FromDyn<()>>, core::option::Option<rustc_data_structures::marker::FromDyn<()>>>::{closure#0}, (core::option::Option<rustc_data_structures::marker::FromDyn<()>>, core::option::Option<rustc_data_structures::marker::FromDyn<()>>)> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#24 0x00007f87bdaa5a03 in rustc_metadata::rmeta::encoder::encode_metadata () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#25 0x00007f87bdaed628 in rustc_metadata::fs::encode_and_write_metadata () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#26 0x00007f87b86608be in rustc_interface::passes::start_codegen () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#27 0x00007f87b8664946 in <rustc_middle::ty::context::GlobalCtxt>::enter::<<rustc_interface::queries::Queries>::codegen_and_build_linker::{closure#0}, core::result::Result<rustc_interface::queries::Linker, rustc_span::ErrorGuaranteed>> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#28 0x00007f87b864db00 in <rustc_interface::queries::Queries>::codegen_and_build_linker () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#29 0x00007f87b849400f in <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#0}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#30 0x00007f87b846e067 in rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}::{closure#0}> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#31 0x00007f87b844dc13 in <rayon_core::thread_pool::ThreadPool>::install::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0} () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#32 0x00007f87b84509a1 in <rayon_core::job::StackJob<rayon_core::latch::LatchRef<rayon_core::latch::LockLatch>, <rayon_core::registry::Registry>::in_worker_cold<<rayon_core::thread_pool::ThreadPool>::install<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>> as rayon_core::job::Job>::execute () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#33 0x00007f87b8338823 in <rayon_core::registry::WorkerThread>::wait_until_cold () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#34 0x00007f87be52d1f9 in <rayon_core::registry::ThreadBuilder>::run () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#35 0x00007f87b8461c57 in <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#3}::{closure#0}::{closure#0}::{closure#0}, ()> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#36 0x00007f87b846e465 in rustc_span::set_session_globals_then::<(), rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#3}::{closure#0}::{closure#0}::{closure#0}> () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#37 0x00007f87b844f282 in <<crossbeam_utils::thread::ScopedThreadBuilder>::spawn<<rayon_core::ThreadPoolBuilder>::build_scoped<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#3}::{closure#0}::{closure#0}, rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#3}::{closure#0}::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#0} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#38 0x00007f87b846af58 in <<std::thread::Builder>::spawn_unchecked_<alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output = ()> + core::marker::Send>, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} () from /home/andjo403/.rustup/toolchains/stage1/lib/librustc_driver-70ddb84e8f7ce707.so
#39 0x00007f87b7898e85 in std::sys::unix::thread::Thread::new::thread_start () from /home/andjo403/.rustup/toolchains/stage1/lib/libstd-d570b0650d35d951.so
#40 0x00007f87b7615609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#41 0x00007f87b7755133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

```

fixes #118205
fixes #117759 from the latest logs it is the same query map as in #118205
fixes #118529
fixes #117784
cc #118206

r? `@SparrowLii`
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Sep 10, 2024
better implementation of signed div_floor/ceil

Tracking issue for signed `div_floor`/`div_ceil`: rust-lang/rust#88581.

This PR improves the implementation of those two functions by adding a better branchless algorithm. Side-by-side comparison of `i32::div_floor` on x86-64:

```asm
div_floor_new:                               div_floor_old:
        push    rax                                  push    rax
        test    esi, esi                             test    esi, esi
        je      .LBB0_3                              je      .LBB1_6
        mov     eax, esi                             mov     eax, esi
        not     eax                                  not     eax
        lea     ecx, [rdi - 2147483648]              lea     ecx, [rdi - 2147483648]
        or      ecx, eax                             or      ecx, eax
        je      .LBB0_2                              je      .LBB1_7
        mov     eax, edi                             mov     eax, edi
        cdq                                          cdq
        idiv    esi                                  idiv    esi
        xor     esi, edi                             test    edx, edx
        sar     esi, 31                              setg    cl
        test    edx, edx                             test    esi, esi
        cmove   esi, edx                             sets    dil
        add     eax, esi                             test    dil, cl
        pop     rcx                                  jne     .LBB1_4
        ret                                          test    edx, edx
.LBB0_3:                                             setns   cl
        lea     rdi, [rip + .L__unnamed_1]           test    esi, esi
        call    qword ptr [rip + panic...]          setle   dl
.LBB0_2:                                             or      dl, cl
        lea     rdi, [rip + .L__unnamed_1]           jne     .LBB1_5
        call    qword ptr [rip + panic...]   .LBB1_4:
                                                     dec     eax
                                             .LBB1_5:
                                                     pop     rcx
                                                     ret
                                             .LBB1_6:
                                                     lea     rdi, [rip + .L__unnamed_2]
                                                     call    qword ptr [rip + panic...]
                                             .LBB1_7:
                                                     lea     rdi, [rip + .L__unnamed_2]
                                                     call    qword ptr [rip + panic...]
```

And on Aarch64:

```asm
_div_floor_new:                                   _div_floor_old:
        stp     x29, x30, [sp, #-16]!                     stp     x29, x30, [sp, #-16]!
        mov     x29, sp                                   mov     x29, sp
        cbz     w1, LBB0_4                                cbz     w1, LBB1_9
        mov     w8, #-2147483648                          mov     x8, x0
        cmp     w0, w8                                    mov     w9, #-2147483648
        b.ne    LBB0_3                                    cmp     w0, w9
        cmn     w1, #1                                    b.ne    LBB1_3
        b.eq    LBB0_5                                    cmn     w1, #1
LBB0_3:                                                   b.eq    LBB1_10
        sdiv    w8, w0, w1                        LBB1_3:
        msub    w9, w8, w1, w0                            sdiv    w0, w8, w1
        eor     w10, w1, w0                               msub    w8, w0, w1, w8
        asr     w10, w10, rust-lang#31                             tbz     w1, rust-lang#31, LBB1_5
        cmp     w9, #0                                    cmp     w8, #0
        csel    w9, wzr, w10, eq                          b.gt    LBB1_7
        add     w0, w9, w8                        LBB1_5:
        ldp     x29, x30, [sp], rust-lang#16                       cmp     w1, #1
        ret                                               b.lt    LBB1_8
LBB0_4:                                                   tbz     w8, rust-lang#31, LBB1_8
        adrp    x0, l___unnamed_1@PAGE            LBB1_7:
        add     x0, x0, l___unnamed_1@PAGEOFF             sub     w0, w0, #1
        bl      panic...                          LBB1_8:
LBB0_5:                                                   ldp     x29, x30, [sp], rust-lang#16
        adrp    x0, l___unnamed_1@PAGE                    ret
        add     x0, x0, l___unnamed_1@PAGEOFF     LBB1_9:
        bl      panic...                                  adrp    x0, l___unnamed_2@PAGE
                                                          add     x0, x0, l___unnamed_2@PAGEOFF
                                                          bl      panic...
                                                  LBB1_10:
                                                          adrp    x0, l___unnamed_2@PAGE
                                                          add     x0, x0, l___unnamed_2@PAGEOFF
                                                          bl      panic...
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants