From b31a7cdcbfcaef2a46803fc7906d5c48c37d9b0e Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Tue, 8 May 2012 20:05:43 -0400 Subject: [PATCH] Internals: Fix uninitialized m_alhs --- src/V3AstNodes.cpp | 4 +++- src/V3AstNodes.h | 4 +++- src/V3Tristate.cpp | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index 28d47e0db..7f3afdb62 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -84,8 +84,10 @@ void AstVar::combineType(AstVarType type) { // These flags get combined with the existing settings of the flags. if (type==AstVarType::INPUT || type==AstVarType::INOUT) m_input = true; - if (type==AstVarType::OUTPUT || type==AstVarType::INOUT) + if (type==AstVarType::OUTPUT || type==AstVarType::INOUT) { m_output = true; + m_declOutput = true; + } if (type==AstVarType::INOUT || type==AstVarType::TRIWIRE || type==AstVarType::TRI0 || type==AstVarType::TRI1) m_tristate = true; diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 809ed050b..64d24e0d2 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -709,6 +709,7 @@ private: bool m_input:1; // Input or inout bool m_output:1; // Output or inout bool m_tristate:1; // Inout or triwire or trireg + bool m_declOutput:1; // Inout or output before tristate resolution bool m_primaryIO:1; // In/out to top level (or directly assigned from same) bool m_sc:1; // SystemC variable bool m_scClocked:1; // SystemC sc_clk<> needed @@ -734,7 +735,7 @@ private: bool m_trace:1; // Trace this variable void init() { - m_input=false; m_output=false; m_tristate=false; + m_input=false; m_output=false; m_tristate=false; m_declOutput=false; m_primaryIO=false; m_sc=false; m_scClocked=false; m_scSensitive=false; m_usedClock=false; m_usedParam=false; m_usedLoopIdx=false; @@ -840,6 +841,7 @@ public: bool isOutOnly() const { return m_output && !m_input; } bool isInout() const { return m_input && m_output; } bool isTristate() const { return m_tristate; } + bool isDeclOutput() const { return m_declOutput; } bool isPrimaryIO() const { return m_primaryIO; } bool isPrimaryIn() const { return isPrimaryIO() && isInput(); } bool isIO() const { return (m_input||m_output); } diff --git a/src/V3Tristate.cpp b/src/V3Tristate.cpp index a8cf39939..a9b728591 100644 --- a/src/V3Tristate.cpp +++ b/src/V3Tristate.cpp @@ -858,9 +858,10 @@ class TristateVisitor : public TristateBaseVisitor { public: // CONSTUCTORS TristateVisitor(AstNode* nodep) { - m_unique = 0; - m_cellp = NULL; m_modp = NULL; + m_cellp = NULL; + m_unique = 0; + m_alhs = false; nodep->accept(*this); } virtual ~TristateVisitor() {