Fix string formats under deep expressions, bug820.

This commit is contained in:
Wilson Snyder 2014-09-21 08:52:09 -04:00
parent 6e476255ca
commit c86fec5307
3 changed files with 7 additions and 3 deletions

View File

@ -25,6 +25,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Fix clang warnings, bug818. [Iztok Jeras] **** Fix clang warnings, bug818. [Iztok Jeras]
**** Fix string formats under deep expressions, bug820. [Iztok Jeras]
* Verilator 3.862 2014-06-10 * Verilator 3.862 2014-06-10

View File

@ -2224,13 +2224,13 @@ public:
void filep(AstNodeVarRef* nodep) { setNOp3p(nodep); } void filep(AstNodeVarRef* nodep) { setNOp3p(nodep); }
}; };
class AstSFormat : public AstNode { class AstSFormat : public AstNodeStmt {
// Parents: statement container // Parents: statement container
// Children: string to load // Children: string to load
// Children: SFORMATF to generate print string // Children: SFORMATF to generate print string
public: public:
AstSFormat(FileLine* fileline, AstNode* lhsp, const string& text, AstNode* exprsp) AstSFormat(FileLine* fileline, AstNode* lhsp, const string& text, AstNode* exprsp)
: AstNode (fileline) { : AstNodeStmt (fileline) {
setOp1p(new AstSFormatF(fileline,text,true,exprsp)); setOp1p(new AstSFormatF(fileline,text,true,exprsp));
setOp3p(lhsp); setOp3p(lhsp);
} }

View File

@ -170,11 +170,13 @@ private:
m_inWhilep->addPrecondsp(newp); m_inWhilep->addPrecondsp(newp);
} else if (m_inTracep) { } else if (m_inTracep) {
m_inTracep->addPrecondsp(newp); m_inTracep->addPrecondsp(newp);
} else { } else if (m_stmtp) {
AstNRelinker linker; AstNRelinker linker;
m_stmtp->unlinkFrBack(&linker); m_stmtp->unlinkFrBack(&linker);
newp->addNext(m_stmtp); newp->addNext(m_stmtp);
linker.relink(newp); linker.relink(newp);
} else {
newp->v3fatalSrc("No statement insertion point.");
} }
} }