Fix bad-syntax crashes, bug1589.

This commit is contained in:
Wilson Snyder 2019-11-04 21:16:07 -05:00
parent cc4cb4e006
commit ca8da1f54f
5 changed files with 78 additions and 18 deletions

View File

@ -27,7 +27,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-1577, bug1582-1585, bug1590-1591. [Eric Rippey]
bug1573-1577, bug1582-1585, bug1589-1591. [Eric Rippey]
**** Fix false CMPCONST/UNSIGNED warnings on "inside", bug1581. [Mitch Hayenga]

View File

@ -849,8 +849,8 @@ class LinkDotFindVisitor : public AstNVisitor {
VSymEnt* okSymp;
aboveSymp = m_statep->findDotted(aboveSymp, scope, baddot, okSymp);
UASSERT_OBJ(aboveSymp, nodep,
"Can't find cell insertion point at '"
<<baddot<<"' in: "<<nodep->prettyNameQ());
"Can't find cell insertion point at "
<<AstNode::prettyNameQ(baddot)<<" in: "<<nodep->prettyNameQ());
}
{
m_scope = m_scope+"."+nodep->name();
@ -880,8 +880,8 @@ class LinkDotFindVisitor : public AstNVisitor {
VSymEnt* okSymp;
aboveSymp = m_statep->findDotted(aboveSymp, dotted, baddot, okSymp);
UASSERT_OBJ(aboveSymp, nodep,
"Can't find cellinline insertion point at '"
<<baddot<<"' in: "<<nodep->prettyNameQ());
"Can't find cellinline insertion point at "
<<AstNode::prettyNameQ(baddot)<<" in: "<<nodep->prettyNameQ());
m_statep->insertInline(aboveSymp, m_modSymp, nodep, ident);
} else { // No __DOT__, just directly underneath
m_statep->insertInline(aboveSymp, m_modSymp, nodep, nodep->name());
@ -2143,9 +2143,10 @@ private:
<<": "<<nodep->prettyNameQ()<<endl
<<(suggest.empty() ? "" : nodep->warnMore()+suggest));
} else {
nodep->v3error("Can't find definition of '"
<<(baddot!="" ? baddot : nodep->prettyName())
<<"' in dotted "<<expectWhat
nodep->v3error("Can't find definition of "
<<(!baddot.empty() ? AstNode::prettyNameQ(baddot)
: nodep->prettyNameQ())
<<" in dotted "<<expectWhat
<<": '"<<m_ds.m_dotText+"."+nodep->prettyName()<<"'");
if (okSymp) {
okSymp->cellErrorScopes(nodep, AstNode::prettyName(m_ds.m_dotText));
@ -2204,8 +2205,8 @@ private:
string inl = AstNode::dedotName(nodep->inlinedDots());
dotSymp = m_statep->findDotted(dotSymp, inl, baddot, okSymp);
UASSERT_OBJ(dotSymp, nodep,
"Couldn't resolve inlined scope '"
<<baddot<<"' in: "<<nodep->inlinedDots());
"Couldn't resolve inlined scope "
<<AstNode::prettyNameQ(baddot)<<" in: "<<nodep->inlinedDots());
}
dotSymp = m_statep->findDotted(dotSymp, nodep->dotted(), baddot, okSymp); // Maybe NULL
if (!m_statep->forScopeCreation()) {
@ -2214,10 +2215,11 @@ private:
nodep->varp(varp);
UINFO(7," Resolved "<<nodep<<endl); // Also prints varp
if (!nodep->varp()) {
nodep->v3error("Can't find definition of '"
<<baddot<<"' in dotted signal: '"
nodep->v3error("Can't find definition of "
<<AstNode::prettyNameQ(baddot)<<" in dotted signal: '"
<<nodep->dotted()+"."+nodep->prettyName()<<"'");
okSymp->cellErrorScopes(nodep);
return;
}
// V3Inst may have expanded arrays of interfaces to
// AstVarXRef's even though they are in the same module detect
@ -2235,8 +2237,9 @@ private:
VSymEnt* foundp = m_statep->findSymPrefixed(dotSymp, nodep->name(), baddot);
AstVarScope* vscp = foundp ? VN_CAST(foundp->nodep(), VarScope) : NULL;
if (!vscp) {
nodep->v3error("Can't find varpin scope of '"<<baddot
<<"' in dotted signal: '"
nodep->v3error("Can't find varpin scope of "
<<AstNode::prettyNameQ(baddot)
<<" in dotted signal: '"
<<nodep->dotted()+"."+nodep->prettyName()<<"'");
okSymp->cellErrorScopes(nodep);
} else {
@ -2342,8 +2345,9 @@ private:
dotSymp = m_statep->findDotted(dotSymp, inl, baddot, okSymp);
if (!dotSymp) {
okSymp->cellErrorScopes(nodep);
nodep->v3fatalSrc("Couldn't resolve inlined scope '"
<<baddot<<"' in: "<<nodep->inlinedDots());
nodep->v3fatalSrc("Couldn't resolve inlined scope "
<<AstNode::prettyNameQ(baddot)
<<" in: "<<nodep->inlinedDots());
}
}
dotSymp = m_statep->findDotted(dotSymp, nodep->dotted(),
@ -2374,8 +2378,9 @@ private:
} else {
string suggest = m_statep->suggestSymFallback(
dotSymp, nodep->name(), LinkNodeMatcherFTask());
nodep->v3error("Can't find definition of '"<<baddot
<<"' in dotted task/function: '"
nodep->v3error("Can't find definition of "
<<AstNode::prettyNameQ(baddot)
<<" in dotted task/function: '"
<<nodep->dotted()+"."+nodep->prettyName()<<"'\n"
<<(suggest.empty() ? "" : nodep->warnMore()+suggest));
okSymp->cellErrorScopes(nodep);

View File

@ -0,0 +1,9 @@
%Error: t/t_fuzz_genintf_bad.v:23: Unsupported: Member call on non-enum object 'VARREF 'j'' which is a 'BASICDTYPE 'integer''
: ... In instance t
j.e(0),
^
%Error: Internal Error: t/t_fuzz_genintf_bad.v:23: ../V3Width.cpp:#: Unlinked pin data type
: ... In instance t
j.e(0),
^
... See the manual and http://www.veripool.org/verilator for more assistance.

View File

@ -0,0 +1,18 @@
#!/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(linter => 1);
lint(
fails => 1,
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -0,0 +1,28 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2019 by Wilson Snyder.
//bug1588
interface intf;
logic a;
modport source(output a);
endinterface
module m1
(
input logic value,
intf.source b
);
endmodule
module t;
intf ifs;
m1 m0(
j.e(0),
.b(ifs)
);
genvar j;
endmodule