Ensure that scratch datum's are zeroed out in the alloca phase.

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!
This commit is contained in:
Niko Matsakis 2012-09-07 09:17:27 -07:00
parent cb53623341
commit cd3cc6d17b

View File

@ -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 * returns a by-ref Datum pointing to it. You must arrange
* any cleanups etc yourself! */ * any cleanups etc yourself! */
let scratch = alloc_ty(bcx, ty); let llty = type_of::type_of(bcx.ccx(), ty);
if zero { zero_mem(bcx, scratch, ty); } let scratch = alloca_maybe_zeroed(bcx, llty, zero);
Datum { val: scratch, ty: ty, mode: ByRef, source: FromRvalue } Datum { val: scratch, ty: ty, mode: ByRef, source: FromRvalue }
} }