Skip to content

Commit f7a991b

Browse files
author
Ellen Arteca
committed
commented out alignment check for int-aligned addrs -- need to make the check make sense (should be len of bytes) for real addrs
1 parent a7b7f19 commit f7a991b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

compiler/rustc_const_eval/src/interpret/memory.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
447447
if let Some(align) = align {
448448
if M::force_int_for_alignment_check(self) {
449449
// `force_int_for_alignment_check` can only be true if `OFFSET_IS_ADDR` is true.
450-
check_offset_align(ptr.addr().bytes(), align)?;
450+
// TODO do a proper check here
451+
// now, addr().bytes() will not give the size of the allocation, it'll be the address
452+
// check_offset_align(ptr.addr().bytes(), align)?;
451453
} else {
452454
// Check allocation alignment and offset alignment.
453455
if alloc_align.bytes() < align.bytes() {

compiler/rustc_middle/src/mir/interpret/allocation.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ impl<Prov> Allocation<Prov> {
211211
let size = Size::from_bytes(slice.len());
212212
// TODO come up with a cleaner way to align the box based on the alignment parameter
213213
let count128 = (slice.len() / 16) + 1;
214+
// println!("ALIGN: {:?}, {:?}", (align.bytes())+1, count128);
214215
let mut vec128: Vec<u128> = Vec::with_capacity(count128);
215216
// TODO avoid excess initialization
216217
vec128.resize(count128, 0);
@@ -289,6 +290,7 @@ impl Allocation {
289290
) -> Result<Allocation<Prov, Extra>, Err> {
290291
// Compute new pointer provenance, which also adjusts the bytes.
291292
// Realign the pointer
293+
// println!("adjusting: {:?}, {:?}", self.align, self.bytes.len());
292294
let count128 = (self.bytes.len() / 16) + 1;
293295
let mut vec128: Vec<u128> = Vec::with_capacity(count128);
294296
vec128.resize(count128, 0);

0 commit comments

Comments
 (0)