@@ -2349,7 +2349,12 @@ fn drop_slot(cx: &@block_ctxt, slot: ValueRef, t: &ty::t) -> result {
2349
2349
let re = drop_ty ( cx, llptr, t) ;
2350
2350
let llty = val_ty ( slot) ;
2351
2351
let llelemty = lib:: llvm:: llvm:: LLVMGetElementType ( llty) ;
2352
- call_bzero ( cx, slot, llsize_of ( llelemty) , C_uint ( 1 u) ) ;
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
+ }
2353
2358
ret re;
2354
2359
}
2355
2360
@@ -5855,7 +5860,13 @@ fn zero_alloca(cx: &@block_ctxt, llptr: ValueRef, t: ty::t) -> result {
5855
5860
bcx = call_bzero ( llalign. bcx , llptr, llsz. val , llalign. val ) . bcx ;
5856
5861
} else {
5857
5862
let llty = type_of ( bcx_ccx ( bcx) , cx. sp , t) ;
5858
- bcx = call_bzero ( cx, llptr, llsize_of ( llty) , C_uint ( 1 u) ) . 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
+ }
5859
5870
}
5860
5871
ret rslt( bcx, llptr) ;
5861
5872
}
0 commit comments