Skip to content

Commit 30c63aa

Browse files
committed
assert consistency
1 parent a2152d2 commit 30c63aa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/librustc_codegen_llvm/common.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -332,17 +332,17 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
332332
alloc: &Allocation,
333333
offset: Size,
334334
) -> PlaceRef<'tcx, &'ll Value> {
335-
let align = alloc.align; // follow what CTFE did, not what the layout says
335+
assert_eq!(alloc.align, layout.align.abi);
336336
let init = const_alloc_to_llvm(self, alloc);
337-
let base_addr = self.static_addr_of(init, align, None);
337+
let base_addr = self.static_addr_of(init, alloc.align, None);
338338

339339
let llval = unsafe { llvm::LLVMConstInBoundsGEP(
340340
self.const_bitcast(base_addr, self.type_i8p()),
341341
&self.const_usize(offset.bytes()),
342342
1,
343343
)};
344344
let llval = self.const_bitcast(llval, self.type_ptr_to(layout.llvm_type(self)));
345-
PlaceRef::new_sized(llval, layout, align)
345+
PlaceRef::new_sized(llval, layout, alloc.align)
346346
}
347347

348348
fn const_ptrcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value {

0 commit comments

Comments
 (0)