diff --git a/Changes b/Changes index 93f8adc36..170c22ef6 100644 --- a/Changes +++ b/Changes @@ -31,6 +31,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Fix power operator calculation, bug730, bug735. [Clifford Wolf] +**** Fix reporting struct members as reserved words, bug741. [Chris Randall] + **** Fix Mac OS-X test issues. [Holger Waechtler] **** Fix C++-2011 warnings. diff --git a/src/V3EmitCSyms.cpp b/src/V3EmitCSyms.cpp index a6212775c..156fcd38d 100644 --- a/src/V3EmitCSyms.cpp +++ b/src/V3EmitCSyms.cpp @@ -203,6 +203,7 @@ class EmitCSyms : EmitCBaseVisitor { } } virtual void visit(AstVar* nodep, AstNUser*) { + nameCheck(nodep); nodep->iterateChildren(*this); if (nodep->isSigUserRdPublic() && !nodep->isParam()) { // The VPI functions require a pointer to allow modification, but parameters are constants @@ -220,6 +221,7 @@ class EmitCSyms : EmitCBaseVisitor { nodep->iterateChildren(*this); } virtual void visit(AstCFunc* nodep, AstNUser*) { + nameCheck(nodep); if (nodep->dpiImport() || nodep->dpiExportWrapper()) { m_dpis.push_back(nodep); } diff --git a/src/V3Name.cpp b/src/V3Name.cpp index b3eb524f5..ae6eb8160 100644 --- a/src/V3Name.cpp +++ b/src/V3Name.cpp @@ -107,6 +107,18 @@ private: nodep->iterateChildren(*this); } } + virtual void visit(AstMemberDType* nodep, AstNUser*) { + if (!nodep->user1()) { + rename(nodep, false); + nodep->iterateChildren(*this); + } + } + virtual void visit(AstMemberSel* nodep, AstNUser*) { + if (!nodep->user1()) { + rename(nodep, false); + nodep->iterateChildren(*this); + } + } virtual void visit(AstScope* nodep, AstNUser*) { if (!nodep->user1SetOnce()) { if (nodep->aboveScopep()) nodep->aboveScopep()->iterate(*this); diff --git a/test_regress/t/t_var_rsvd.v b/test_regress/t/t_var_rsvd.v index 446a17823..e4ea140e1 100644 --- a/test_regress/t/t_var_rsvd.v +++ b/test_regress/t/t_var_rsvd.v @@ -15,10 +15,16 @@ module t (/*AUTOARG*/ reg vector; // OK, as not public reg switch /*verilator public*/; // Bad + typedef struct packed { + logic [31:0] vector; // OK, as not public + } test; + test t; + // global is a 1800-2009 reserved word, but we allow it when possible. reg global; initial begin + t.vector = 1; $write("*-* All Finished *-*\n"); $finish; end