From 1bc362908440792123d8b8022f6e09a7401389f2 Mon Sep 17 00:00:00 2001 From: Christian Poveda Date: Wed, 25 Dec 2019 18:22:33 -0500 Subject: [PATCH] do padding correctly --- src/shims/fs.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/shims/fs.rs b/src/shims/fs.rs index a5bac27cc449..8cd1afd02c9f 100644 --- a/src/shims/fs.rs +++ b/src/shims/fs.rs @@ -302,12 +302,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx let blksize_t_layout = this.libc_ty_layout("blksize_t")?; let uint32_t_layout = this.libc_ty_layout("uint32_t")?; - // We need to add 32 bits of padding after `st_rdev` if we are in a 64-bit platform. To do - // this, we store `st_rdev` as a `c_long` instead of a `dev_t`. - let st_rdev_layout = if this.tcx.sess.target.ptr_width == 64 { - long_layout + // We need to add 32 bits of padding after `st_rdev` if we are in a 64-bit platform. + let pad_layout = if this.tcx.sess.target.ptr_width == 64 { + uint32_t_layout } else { - dev_t_layout + this.layout_of(this.tcx.mk_unit())? }; let imms = [ @@ -317,7 +316,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx immty_from_uint_checked(0u128, ino_t_layout)?, // st_ino immty_from_uint_checked(0u128, uid_t_layout)?, // st_uid immty_from_uint_checked(0u128, gid_t_layout)?, // st_gid - immty_from_uint_checked(0u128, st_rdev_layout)?, // st_rdev + immty_from_uint_checked(0u128, dev_t_layout)?, // st_rdev + immty_from_uint_checked(0u128, pad_layout)?, // padding for 64-bit targets immty_from_uint_checked(access_sec, time_t_layout)?, // st_atime immty_from_uint_checked(access_nsec, long_layout)?, // st_atime_nsec immty_from_uint_checked(modified_sec, time_t_layout)?, // st_mtime