Fix missing error when parameter assigned to type, bug1576.

This commit is contained in:
Wilson Snyder 2019-10-30 18:18:29 -04:00
parent 40bdd85a07
commit 63373f6f4c
5 changed files with 19 additions and 13 deletions

View File

@ -25,7 +25,7 @@ The contributors that suggested a given feature are shown in []. Thanks!
**** Fix multithreaded yield behavior when no work. [Patrick Stewart]
**** Fix bad-syntax crashes, bug1548, bug1550-1553, bug1557-1560, bug1563,
bug1573-1575. [Eric Rippey]
bug1573-1576. [Eric Rippey]
**** Benchmark --protect-lib runtime, bug1519. [Todd Strader]

View File

@ -3478,7 +3478,12 @@ private:
UASSERT_OBJ(stage == FINAL, nodep, "Bad state to iterateCheck");
UASSERT_OBJ(underp && underp->dtypep(), nodep,
"Node has no type"); // Perhaps forgot to do a prelim visit on it?
if (expDTypep == underp->dtypep()) { // Perfect
if (VN_IS(underp, NodeDType)) { // Note the node itself, not node's data type
// Must be near top of these checks as underp->dtypep() will look normal
underp->v3error(ucfirst(nodep->prettyOperatorName())
<<" expected non-datatype "<<side
<<" but '"<<underp->name()<<"' is a datatype.");
} else if (expDTypep == underp->dtypep()) { // Perfect
underp = userIterateSubtreeReturnEdits(underp, WidthVP(SELF, FINAL).p());
} else if (expDTypep->isDouble() && underp->isDouble()) { // Also good
underp = userIterateSubtreeReturnEdits(underp, WidthVP(SELF, FINAL).p());
@ -3491,10 +3496,6 @@ private:
} else if (expDTypep->isString() && !underp->dtypep()->isString()) {
underp = spliceCvtString(underp);
underp = userIterateSubtreeReturnEdits(underp, WidthVP(SELF, FINAL).p());
} else if (VN_IS(underp, NodeDType)) { // Note the node itself, not node's data type
underp->v3error(ucfirst(nodep->prettyOperatorName())
<<" expected non-datatype "<<side
<<" but '"<<underp->name()<<"' is a datatype.");
} else {
AstBasicDType* expBasicp = expDTypep->basicp();
AstBasicDType* underBasicp = underp->dtypep()->basicp();

View File

@ -1,4 +1,9 @@
%Error: t/t_param_type_bad2.v:8: Parameter type's initial value isn't a type: 'bad2'
localparam type bad2 = 2;
^~~~
%Error: t/t_param_type_bad2.v:7: Operator VAR 't' expected non-datatype Initial value but 'logic' is a datatype.
: ... In instance t
localparam t = logic;
^~~~~
%Error: t/t_param_type_bad2.v:8: Operator VAR 't2' expected non-datatype Initial value but 'real' is a datatype.
: ... In instance t
localparam t2 = realtime;
^~~~~~~~
%Error: Exiting due to

View File

@ -9,9 +9,9 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(vlt => 1);
lint(
compile(
# Bug1575 required trace to crash
verilator_flags2 => ["--trace"],
verilator_flags2 => ["--trace --cc"],
fails => 1,
expect_filename => $Self->{golden_filename},
);

View File

@ -4,6 +4,6 @@
// without warranty, 2019 by Wilson Snyder.
module t;
localparam type t = logic; // Fine
localparam type bad2 = 2; // Bad
localparam t = logic; // Bad
localparam t2 = realtime; // Bad
endmodule