diff --git a/Changes b/Changes index b66625da0..bc668b14b 100644 --- a/Changes +++ b/Changes @@ -19,6 +19,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Fix optional parameter keyword in module #(), bug810. [Iztok Jeras] +**** Fix $warning/$error multi-argument ordering, bug816. [Jonathon Donaldson] + * Verilator 3.862 2014-06-10 diff --git a/src/V3Assert.cpp b/src/V3Assert.cpp index 752eb0ea0..4163c2886 100644 --- a/src/V3Assert.cpp +++ b/src/V3Assert.cpp @@ -61,10 +61,13 @@ private: void replaceDisplay(AstDisplay* nodep, const string& prefix) { nodep->displayType(AstDisplayType::DT_WRITE); nodep->fmtp()->text(assertDisplayMessage(nodep, prefix, nodep->fmtp()->text())); - AstNode* timesp = nodep->fmtp()->exprsp(); if (timesp) timesp->unlinkFrBack(); // cppcheck-suppress nullPointer - timesp = timesp->addNext(new AstTime(nodep->fileline())); - nodep->fmtp()->exprsp(timesp); + AstNode* timenewp = new AstTime(nodep->fileline()); + if (AstNode* timesp = nodep->fmtp()->exprsp()) { + timesp->unlinkFrBackWithNext(); + timenewp->addNext(timesp); + } + nodep->fmtp()->exprsp(timenewp); if (!nodep->fmtp()->scopeNamep() && nodep->fmtp()->formatScopeTracking()) { nodep->fmtp()->scopeNamep(new AstScopeName(nodep->fileline())); } diff --git a/test_regress/t/t_assert_basic.v b/test_regress/t/t_assert_basic.v index 02322c752..e51eed541 100644 --- a/test_regress/t/t_assert_basic.v +++ b/test_regress/t/t_assert_basic.v @@ -33,7 +33,7 @@ module t (/*AUTOARG*/ assert (0) else $info; assert (0) else $info("Info message"); assert (0) else $info("Info message, cyc=%d", cyc); - InWarningBlock: assert (0) else $warning("Warning...."); + InWarningBlock: assert (0) else $warning("Warning.... 1.0=%f 2.0=%f", 1.0, 2.0); InErrorBlock: assert (0) else $error("Error...."); assert (0) else $fatal(1,"Fatal...."); `endif