Fix misc bad-syntax crashes, bug1557-1560.

This commit is contained in:
Wilson Snyder 2019-10-16 20:05:29 -04:00
parent 46ab907f6a
commit 6081c262f2
3 changed files with 6 additions and 5 deletions

View File

@ -16,7 +16,7 @@ The contributors that suggested a given feature are shown in []. Thanks!
**** Fix multithreaded yield behavior when no work. [Patrick Stewart]
**** Fix misc bad-syntax crashes, bug1548, bug1550-1553. [Eric Rippey]
**** Fix misc bad-syntax crashes, bug1548, bug1550-1553, bug1557-1560. [Eric Rippey]
* Verilator 4.020 2019-10-06

View File

@ -377,8 +377,8 @@ string FileLine::warnContext(bool secondary) const {
out += sourceLine+"\n";
out += string((firstColumn()-1), ' ')+'^';
// Can't use UASSERT_OBJ used in warnings already inside the error end handler
UASSERT_STATIC(lastColumn() >= firstColumn(), "Column numbers backwards");
if (lastColumn() != firstColumn()) {
if (lastColumn() > firstColumn()) {
// Note lastColumn() can be <= firstColumn() in some weird preproc expansions
out += string((lastColumn()-firstColumn()-1), '~');
}
out += "\n";

View File

@ -192,6 +192,7 @@ int V3ParseGrammar::s_modTypeImpNum = 0;
// Macro functions
#define CRELINE() (PARSEP->copyOrSameFileLine()) // Only use in empty rules, so lines point at beginnings
#define FILELINE_OR_CRE(nodep) ((nodep) ? (nodep)->fileline() : CRELINE())
#define VARRESET_LIST(decl) { GRAMMARP->m_pinNum=1; GRAMMARP->m_pinAnsi=false; \
VARRESET(); VARDECL(decl); } // Start of pinlist
@ -2297,7 +2298,7 @@ cellpinItemE<pinp>: // IEEE: named_port_connection + empty
//UNSUP '.' idAny '(' expr ':' expr ')' { }
//UNSUP '.' idAny '(' expr ':' expr ':' expr ')' { }
//
| expr { $$ = new AstPin($1->fileline(),PINNUMINC(),"",$1); }
| expr { $$ = new AstPin(FILELINE_OR_CRE($1),PINNUMINC(),"",$1); }
//UNSUP expr ':' expr { }
//UNSUP expr ':' expr ':' expr { }
;
@ -2741,7 +2742,7 @@ assignment_pattern<patternp>: // ==IEEE: assignment_pattern
// // also IEEE "''{' array_pattern_key ':' ...
| yP_TICKBRA patternMemberList '}' { $$ = new AstPattern($1,$2); }
// // IEEE: Not in grammar, but in VMM
| yP_TICKBRA '}' { $$ = NULL; $1->v3error("Unsupported: Empty '{}"); }
| yP_TICKBRA '}' { $$ = new AstPattern($1, NULL); $1->v3error("Unsupported: Empty '{}"); }
;
// "datatype id = x {, id = x }" | "yaId = x {, id=x}" is legal