Skip to content

Commit cd3cc6d

Browse files
committed
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!
1 parent cb53623 commit cd3cc6d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rustc/middle/trans/datum.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ fn scratch_datum(bcx: block, ty: ty::t, zero: bool) -> Datum {
177177
* returns a by-ref Datum pointing to it. You must arrange
178178
* any cleanups etc yourself! */
179179

180-
let scratch = alloc_ty(bcx, ty);
181-
if zero { zero_mem(bcx, scratch, ty); }
180+
let llty = type_of::type_of(bcx.ccx(), ty);
181+
let scratch = alloca_maybe_zeroed(bcx, llty, zero);
182182
Datum { val: scratch, ty: ty, mode: ByRef, source: FromRvalue }
183183
}
184184

0 commit comments

Comments
 (0)