Skip to content

Commit 444cad8

Browse files
committed
---
yaml --- r: 4422 b: refs/heads/master c: 3d5a777 h: refs/heads/master v: v3
1 parent 3ee3f9a commit 444cad8

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 66a255ac9291306f3943acb2a00e159ccc15dfa4
2+
refs/heads/master: 3d5a777fe19ab210aedf473678687a98023ff586

trunk/src/comp/middle/trans.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,7 +2349,12 @@ fn drop_slot(cx: &@block_ctxt, slot: ValueRef, t: &ty::t) -> result {
23492349
let re = drop_ty(cx, llptr, t);
23502350
let llty = val_ty(slot);
23512351
let llelemty = lib::llvm::llvm::LLVMGetElementType(llty);
2352-
call_bzero(cx, slot, llsize_of(llelemty), C_uint(1u));
2352+
if ty::type_is_structural(bcx_tcx(cx), t) {
2353+
call_bzero(cx, slot, C_uint(llsize_of_real(bcx_ccx(cx), llelemty)),
2354+
C_uint(llalign_of_real(bcx_ccx(cx), llelemty)));
2355+
} else {
2356+
cx.build.Store(C_null(llelemty), slot);
2357+
}
23532358
ret re;
23542359
}
23552360

@@ -5855,7 +5860,13 @@ fn zero_alloca(cx: &@block_ctxt, llptr: ValueRef, t: ty::t) -> result {
58555860
bcx = call_bzero(llalign.bcx, llptr, llsz.val, llalign.val).bcx;
58565861
} else {
58575862
let llty = type_of(bcx_ccx(bcx), cx.sp, t);
5858-
bcx = call_bzero(cx, llptr, llsize_of(llty), C_uint(1u)).bcx;
5863+
if ty::type_is_structural(bcx_tcx(cx), t) {
5864+
bcx = call_bzero(cx, llptr,
5865+
C_uint(llsize_of_real(bcx_ccx(cx), llty)),
5866+
C_uint(llalign_of_real(bcx_ccx(cx), llty))).bcx;
5867+
} else {
5868+
bcx.build.Store(C_null(llty), llptr);
5869+
}
58595870
}
58605871
ret rslt(bcx, llptr);
58615872
}

0 commit comments

Comments
 (0)