diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index c9b036b80..4ed83a2c2 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -167,6 +167,10 @@ public: const std::unique_ptr logp{V3File::new_ofstream(filename)}; if (logp->fail()) v3fatal("Can't write " << filename); std::ostream& os = *logp; + // TODO the symbol table has node pointers which may be + // dangling, as we call deleteTree in these visitors without + // pushing for later deletion (or deleting from the symbol table) + // So, only completely safe to call this when under --debug or --debug-leak. m_syms.dumpSelf(os); bool first = true; for (int samn = 0; samn < SAMN__MAX; ++samn) { @@ -907,8 +911,8 @@ class LinkDotFindVisitor final : public VNVisitor { } else { VSymEnt* const upperSymp = m_statep->dunitEntp(); m_scope = nodep->name(); - m_curSymp = m_modSymp = m_statep->insertBlock( - upperSymp, nodep->name() + "::", nodep, m_classOrPackagep); + m_curSymp = m_modSymp = m_statep->insertBlock(upperSymp, nodep->name(), nodep, + m_classOrPackagep); UINFO(9, "New module scope " << m_curSymp << endl); } } diff --git a/src/V3SymTable.h b/src/V3SymTable.h index 815356fa4..43f1adec9 100644 --- a/src/V3SymTable.h +++ b/src/V3SymTable.h @@ -69,7 +69,7 @@ public: os << " se" << cvtToHex(this) << std::setw(0); os << " fallb=se" << cvtToHex(m_fallbackp); if (m_symPrefix != "") os << " symPrefix=" << m_symPrefix; - os << " n=" << nodep(); + if (nodep()) os << " n=" << nodep(); os << '\n'; if (VL_UNCOVERABLE(!doneSymsr.insert(this).second)) { os << indent << "| ^ duplicate, so no children printed\n"; // LCOV_EXCL_LINE