Fix internal error on "input x =" syntax error, bug716.

This commit is contained in:
Wilson Snyder 2014-03-08 12:26:34 -05:00
parent 94efaa7675
commit 68afc96a9f
4 changed files with 53 additions and 1 deletions

View File

@ -13,6 +13,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Fix missing VL_SHIFTRS_IQI with WIDTH warning, bug714. [Fabrizio Ferrandi]
**** Fix internal error on "input x =" syntax error, bug716. [Lane Brooks]
* Verilator 3.855 2014-01-18

View File

@ -61,6 +61,7 @@ private:
bool m_needStart; // Need start marker on lower AstParse
AstNodeModule* m_valueModp; // If set, move AstVar->valuep() initial values to this module
AstNodeModule* m_modp; // Current module
AstNodeFTask* m_ftaskp; // Current task
// METHODS
static int debug() {
@ -85,6 +86,14 @@ private:
}
// VISITs
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
if (!nodep->user1SetOnce()) { // Process only once.
cleanFileline(nodep);
m_ftaskp = nodep;
nodep->iterateChildren(*this);
m_ftaskp = NULL;
}
}
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
if (!nodep->user1SetOnce()) { // Process only once.
cleanFileline(nodep);
@ -138,7 +147,11 @@ private:
// A variable with an = value can be three things:
FileLine* fl = nodep->valuep()->fileline();
// 1. Parameters and function inputs: It's a default to use if not overridden
if (nodep->isParam() || nodep->isInOnly()) {
if (nodep->isParam() || (m_ftaskp && nodep->isInOnly())) {
}
else if (!m_ftaskp && nodep->isInOnly()) {
nodep->v3error("Unsupported: Default value on module input: "<<nodep->prettyName());
nodep->valuep()->unlinkFrBack()->deleteTree();
} // 2. Under modules, it's an initial value to be loaded at time 0 via an AstInitial
else if (m_valueModp) {
nodep->addNextHere
@ -313,6 +326,7 @@ public:
LinkParseVisitor(AstNetlist* rootp) {
m_varp = NULL;
m_modp = NULL;
m_ftaskp = NULL;
m_inAlways = false;
m_inGenerate = false;
m_needStart = false;

View File

@ -0,0 +1,24 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2008 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.
$Self->{vlt} or $Self->skip("Verilator only test");
compile (
v_flags2 => ["--lint-only"],
fails=>1,
verilator_make_gcc => 0,
make_top_shell => 0,
make_main => 0,
expect=>
'%Error: t/t_lint_input_eq_bad.v:\d+: Unsupported: Default value on module input: i2
%Error: Exiting due to.*',
);
ok(1);
1;

View File

@ -0,0 +1,12 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2010 by Wilson Snyder.
module t
(
input wire i,
input wire i2 = i // BAD
);
endmodule