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);