@@ -130,7 +130,11 @@ trait EvalContextExtPrivate<'tcx>: crate::MiriInterpCxExt<'tcx> {
130130 let ( modified_sec, modified_nsec) = metadata. modified . unwrap_or ( ( 0 , 0 ) ) ;
131131 let mode = metadata. mode . to_uint ( this. libc_ty_layout ( "mode_t" ) . size ) ?;
132132
133- let buf = this. deref_pointer_as ( buf_op, this. libc_ty_layout ( "stat" ) ) ?;
133+ // We do *not* use `deref_pointer_as` here since determining the right pointee type
134+ // is highly non-trivial: it depends on which exact alias of the function was invoked
135+ // (e.g. `fstat` vs `fstat64`), and then on FreeBSD it also depends on the ABI level
136+ // which can be different between the libc used by std and the libc used by everyone else.
137+ let buf = this. deref_pointer ( buf_op) ?;
134138 this. write_int_fields_named (
135139 & [
136140 ( "st_dev" , metadata. dev . into ( ) ) ,
@@ -156,9 +160,6 @@ trait EvalContextExtPrivate<'tcx>: crate::MiriInterpCxExt<'tcx> {
156160 if matches ! ( & this. tcx. sess. target. os, Os :: MacOs | Os :: FreeBsd ) {
157161 this. write_int_fields_named (
158162 & [
159- ( "st_atime_nsec" , access_nsec. into ( ) ) ,
160- ( "st_mtime_nsec" , modified_nsec. into ( ) ) ,
161- ( "st_ctime_nsec" , 0 ) ,
162163 ( "st_birthtime" , created_sec. into ( ) ) ,
163164 ( "st_birthtime_nsec" , created_nsec. into ( ) ) ,
164165 ( "st_flags" , 0 ) ,
0 commit comments