Fix tagging order

This commit is contained in:
Tim Diekmann 2019-04-07 21:09:21 +02:00
parent 6e4264bf27
commit d1d05c8b41
No known key found for this signature in database
GPG key ID: 58CD76F88DF563E0

View file

@ -100,19 +100,21 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
size
} else {
return err!(MachineError(format!(
"calloc: overflow of items * size: {} * {}",
items, size,
"calloc: overflow of items * count: {} * {}",
items, count,
)));
};
if size == 0 {
this.write_null(dest)?;
} else {
let align = this.tcx.data_layout.pointer_align.abi;
let ptr = this.memory_mut().allocate(Size::from_bytes(size), align, MiriMemoryKind::C.into());
let ptr = this.memory_mut()
.allocate(Size::from_bytes(size), align, MiriMemoryKind::C.into())
.with_default_tag();
this.memory_mut()
.get_mut(ptr.alloc_id)?
.write_repeat(tcx, ptr, 0, Size::from_bytes(size))?;
this.write_scalar(Scalar::Ptr(ptr.with_default_tag()), dest)?;
this.write_scalar(Scalar::Ptr(ptr), dest)?;
}
}
"posix_memalign" => {