Skip to content

Commit 1bc3629

Browse files
committed
do padding correctly
1 parent d176259 commit 1bc3629

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/shims/fs.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
302302
let blksize_t_layout = this.libc_ty_layout("blksize_t")?;
303303
let uint32_t_layout = this.libc_ty_layout("uint32_t")?;
304304

305-
// We need to add 32 bits of padding after `st_rdev` if we are in a 64-bit platform. To do
306-
// this, we store `st_rdev` as a `c_long` instead of a `dev_t`.
307-
let st_rdev_layout = if this.tcx.sess.target.ptr_width == 64 {
308-
long_layout
305+
// We need to add 32 bits of padding after `st_rdev` if we are in a 64-bit platform.
306+
let pad_layout = if this.tcx.sess.target.ptr_width == 64 {
307+
uint32_t_layout
309308
} else {
310-
dev_t_layout
309+
this.layout_of(this.tcx.mk_unit())?
311310
};
312311

313312
let imms = [
@@ -317,7 +316,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
317316
immty_from_uint_checked(0u128, ino_t_layout)?, // st_ino
318317
immty_from_uint_checked(0u128, uid_t_layout)?, // st_uid
319318
immty_from_uint_checked(0u128, gid_t_layout)?, // st_gid
320-
immty_from_uint_checked(0u128, st_rdev_layout)?, // st_rdev
319+
immty_from_uint_checked(0u128, dev_t_layout)?, // st_rdev
320+
immty_from_uint_checked(0u128, pad_layout)?, // padding for 64-bit targets
321321
immty_from_uint_checked(access_sec, time_t_layout)?, // st_atime
322322
immty_from_uint_checked(access_nsec, long_layout)?, // st_atime_nsec
323323
immty_from_uint_checked(modified_sec, time_t_layout)?, // st_mtime

0 commit comments

Comments
 (0)