Skip to content

Commit

Permalink
Ensure that scratch datum's are zeroed out in the alloca phase.
Browse files Browse the repository at this point in the history
This should address the valgrind failure that @elliotslaughter
was seeing, though I am not sure why the bots / test continued
to pass, since this is precisely the condition this test was looking
for!
  • Loading branch information
nikomatsakis committed Sep 7, 2012
1 parent cb53623 commit cd3cc6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rustc/middle/trans/datum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ fn scratch_datum(bcx: block, ty: ty::t, zero: bool) -> Datum {
* returns a by-ref Datum pointing to it. You must arrange
* any cleanups etc yourself! */

let scratch = alloc_ty(bcx, ty);
if zero { zero_mem(bcx, scratch, ty); }
let llty = type_of::type_of(bcx.ccx(), ty);
let scratch = alloca_maybe_zeroed(bcx, llty, zero);
Datum { val: scratch, ty: ty, mode: ByRef, source: FromRvalue }
}

Expand Down

0 comments on commit cd3cc6d

Please sign in to comment.