diff --git a/Changes b/Changes index e17a43cef..98fdc63f0 100644 --- a/Changes +++ b/Changes @@ -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, bug1574. [Eric Rippey] + bug1573-1575. [Eric Rippey] **** Benchmark --protect-lib runtime, bug1519. [Todd Strader] diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 815bf5905..980fbdd1c 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -3491,6 +3491,10 @@ 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 "<name()<<"' is a datatype."); } else { AstBasicDType* expBasicp = expDTypep->basicp(); AstBasicDType* underBasicp = underp->dtypep()->basicp(); diff --git a/test_regress/t/t_param_type_bad.out b/test_regress/t/t_param_type_bad.out new file mode 100644 index 000000000..269e88619 --- /dev/null +++ b/test_regress/t/t_param_type_bad.out @@ -0,0 +1,4 @@ +%Error: t/t_param_type_bad.v:8: Parameter type's initial value isn't a type: 'bad2' + localparam type bad2 = 2; + ^~~~ +%Error: Exiting due to diff --git a/test_regress/t/t_param_type_bad.pl b/test_regress/t/t_param_type_bad.pl new file mode 100755 index 000000000..ef912260b --- /dev/null +++ b/test_regress/t/t_param_type_bad.pl @@ -0,0 +1,20 @@ +#!/usr/bin/perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2003 by Wilson Snyder. This program is free software; you can +# redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. + +scenarios(vlt => 1); + +lint( + # Bug1575 required trace to crash + verilator_flags2 => ["--trace"], + fails => 1, + expect_filename => $Self->{golden_filename}, + ); + +ok(1); +1; diff --git a/test_regress/t/t_param_type_bad.v b/test_regress/t/t_param_type_bad.v new file mode 100644 index 000000000..686f415c4 --- /dev/null +++ b/test_regress/t/t_param_type_bad.v @@ -0,0 +1,9 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2019 by Wilson Snyder. + +module t; + localparam type t = logic; // Fine + localparam type bad2 = 2; // Bad +endmodule diff --git a/test_regress/t/t_param_type_bad2.out b/test_regress/t/t_param_type_bad2.out new file mode 100644 index 000000000..fa74f0304 --- /dev/null +++ b/test_regress/t/t_param_type_bad2.out @@ -0,0 +1,4 @@ +%Error: t/t_param_type_bad2.v:8: Parameter type's initial value isn't a type: 'bad2' + localparam type bad2 = 2; + ^~~~ +%Error: Exiting due to diff --git a/test_regress/t/t_param_type_bad2.pl b/test_regress/t/t_param_type_bad2.pl new file mode 100755 index 000000000..ef912260b --- /dev/null +++ b/test_regress/t/t_param_type_bad2.pl @@ -0,0 +1,20 @@ +#!/usr/bin/perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2003 by Wilson Snyder. This program is free software; you can +# redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. + +scenarios(vlt => 1); + +lint( + # Bug1575 required trace to crash + verilator_flags2 => ["--trace"], + fails => 1, + expect_filename => $Self->{golden_filename}, + ); + +ok(1); +1; diff --git a/test_regress/t/t_param_type_bad2.v b/test_regress/t/t_param_type_bad2.v new file mode 100644 index 000000000..686f415c4 --- /dev/null +++ b/test_regress/t/t_param_type_bad2.v @@ -0,0 +1,9 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2019 by Wilson Snyder. + +module t; + localparam type t = logic; // Fine + localparam type bad2 = 2; // Bad +endmodule