From 03764a400d6a9cd7757ecacf046a30c678efe17d Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Wed, 8 Nov 2017 20:35:18 +0000 Subject: [PATCH] Fix assertion failure in vvp wide functor. If the functor output is read before any values have propagated to the functor inputs, the internal storage won't have been initialised. (cherry picked from commit ad83a135e51f8eeeba4bf51225a13cab6459e021) --- vvp/vvp_net.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index 7a3c3bb7b..9b0c83a5d 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -3421,7 +3421,8 @@ unsigned vvp_wide_fun_core::port_count() const vvp_vector4_t& vvp_wide_fun_core::value(unsigned idx) { assert(idx < nports_); - assert(port_values_); + if (port_values_ == 0) + port_values_ = new vvp_vector4_t [nports_]; return port_values_[idx]; }