From 4a5a56f8ef0c42ba14af7e226508f56f44cb0251 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 3 Feb 2013 12:21:48 -0500 Subject: [PATCH] Tests: Fix t_vpi_var uninitialized --- include/verilated_vpi.h | 2 +- test_regress/t/t_vpi_var.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/verilated_vpi.h b/include/verilated_vpi.h index 3442fd204..f31484b0c 100644 --- a/include/verilated_vpi.h +++ b/include/verilated_vpi.h @@ -107,7 +107,7 @@ public: // cppcheck-suppress uninitVar // m_value VerilatedVpioCb(const t_cb_data* cbDatap, QData time) : m_cbData(*cbDatap), m_time(time) { - m_value.format = cbDatap->value?cbDatap->value->format:vpiSuppressVal; + m_value.format = cbDatap->value ? cbDatap->value->format : vpiSuppressVal; m_cbData.value = &m_value; } virtual ~VerilatedVpioCb() {} diff --git a/test_regress/t/t_vpi_var.cpp b/test_regress/t/t_vpi_var.cpp index f5491c988..bbb7fa97b 100644 --- a/test_regress/t/t_vpi_var.cpp +++ b/test_regress/t/t_vpi_var.cpp @@ -125,6 +125,7 @@ int _mon_check_callbacks() { cb_data.reason = cbEndOfSimulation; cb_data.cb_rtn = NULL; cb_data.user_data = 0; + cb_data.value = NULL; vpiHandle vh = vpi_register_cb(&cb_data); CHECK_RESULT_NZ(vh);