File tree 1 file changed +5
-4
lines changed
src/librustc_codegen_llvm
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -333,20 +333,21 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
333
333
offset : Size ,
334
334
) -> PlaceRef < ' tcx , & ' ll Value > {
335
335
assert_eq ! ( alloc. align, layout. align. abi) ;
336
+ let llty = self . type_ptr_to ( layout. llvm_type ( self ) ) ;
336
337
let llval = if layout. size == Size :: ZERO {
337
338
let llval = self . const_usize ( alloc. align . bytes ( ) ) ;
338
- unsafe { llvm:: LLVMConstIntToPtr ( llval, self . type_ptr_to ( self . type_i8p ( ) ) ) }
339
+ unsafe { llvm:: LLVMConstIntToPtr ( llval, llty ) }
339
340
} else {
340
341
let init = const_alloc_to_llvm ( self , alloc) ;
341
342
let base_addr = self . static_addr_of ( init, alloc. align , None ) ;
342
343
343
- unsafe { llvm:: LLVMConstInBoundsGEP (
344
+ let llval = unsafe { llvm:: LLVMConstInBoundsGEP (
344
345
self . const_bitcast ( base_addr, self . type_i8p ( ) ) ,
345
346
& self . const_usize ( offset. bytes ( ) ) ,
346
347
1 ,
347
- ) }
348
+ ) } ;
349
+ self . const_bitcast ( llval, llty)
348
350
} ;
349
- let llval = self . const_bitcast ( llval, self . type_ptr_to ( layout. llvm_type ( self ) ) ) ;
350
351
PlaceRef :: new_sized ( llval, layout, alloc. align )
351
352
}
352
353
You can’t perform that action at this time.
0 commit comments