diff options
author | John Hodge <tpg@ucc.asn.au> | 2019-08-04 19:27:02 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2019-08-04 19:27:02 +0800 |
commit | ebebe58a9a0f1399ac50ab956f254d2c0d2c813d (patch) | |
tree | 5bd04ce4f120324108e7354549a632823803c64e /tools | |
parent | a2d34eb26271b1dd0fbe2936b49a866fccf8b605 (diff) | |
download | mrust-ebebe58a9a0f1399ac50ab956f254d2c0d2c813d.tar.gz |
Standalone MIRI - Fix write_bytes count
Diffstat (limited to 'tools')
-rw-r--r-- | tools/standalone_miri/miri.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/standalone_miri/miri.cpp b/tools/standalone_miri/miri.cpp index e38ff845..2deb421b 100644 --- a/tools/standalone_miri/miri.cpp +++ b/tools/standalone_miri/miri.cpp @@ -2543,13 +2543,15 @@ bool InterpreterThread::call_intrinsic(Value& rv, const RcString& name, const :: auto& dst_ptr_v = args.at(0); auto byte = args.at(1).read_u8(0); auto count = args.at(2).read_usize(0); + auto bytes = count * ty_params.tys.at(0).get_size(); - LOG_DEBUG("'write_bytes'(" << dst_ptr_v << ", " << byte << ", " << count << ")"); + LOG_DEBUG("'write_bytes'(" << dst_ptr_v << ", " << (int)byte << ", " << count << "): bytes=" << bytes); if( count > 0 ) { - auto dst_vr = dst_ptr_v.read_pointer_valref_mut(0, count); - memset(dst_vr.data_ptr_mut(), byte, count); + auto dst_vr = dst_ptr_v.read_pointer_valref_mut(0, bytes); + memset(dst_vr.data_ptr_mut(), byte, bytes); + dst_vr.mark_bytes_valid(0, bytes); } } // - Unsized stuff |