diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index afa2d2fcc..1dcc84863 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -2642,6 +2642,7 @@ vvp_vector8_t::vvp_vector8_t(const vvp_vector4_t&that, return; if (size_ <= sizeof val_) { + ptr_ = 0; // Prefill all val_ bytes for (unsigned idx = 0 ; idx < size_ ; idx += 1) val_[idx] = vvp_scalar_t(that.value(idx),str0, str1).raw(); } else { diff --git a/vvp/vvp_net.h b/vvp/vvp_net.h index f12e10f81..639bd214d 100644 --- a/vvp/vvp_net.h +++ b/vvp/vvp_net.h @@ -873,6 +873,7 @@ inline vvp_vector8_t::vvp_vector8_t(unsigned size__) : size_(size__) { if (size_ <= sizeof val_) { + // This should set all the bytes of val_ to 0 ptr_ = 0; } else { ptr_ = new unsigned char[size_]; @@ -914,6 +915,7 @@ inline bool vvp_vector8_t::eeq(const vvp_vector8_t&that) const return true; if (size_ <= sizeof val_) + // This is equivilent to memcmp(val_, that.val_, sizeof val_)==0 return ptr_ == that.ptr_; else return memcmp(ptr_, that.ptr_, size_) == 0;