From cd3cc6d17b68ef18199a54372963b00ba8a0a84f Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 7 Sep 2012 09:17:27 -0700 Subject: 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! --- src/rustc/middle/trans/datum.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/rustc') diff --git a/src/rustc/middle/trans/datum.rs b/src/rustc/middle/trans/datum.rs index d6338eb8565..539439ecc81 100644 --- a/src/rustc/middle/trans/datum.rs +++ b/src/rustc/middle/trans/datum.rs @@ -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 } } -- cgit 1.4.1-3-g733a5