diff options
author | Gary Wong <gtw@gnu.org> | 2020-04-05 21:35:21 -0600 |
---|---|---|
committer | Gary Wong <gtw@gnu.org> | 2020-04-05 21:42:45 -0600 |
commit | ec1eea9990152608c32614655ff315222fa11201 (patch) | |
tree | f9258de91b83e15a657667c8e1f76918f601ea40 | |
parent | f9a76c56f7c9c2b894bfc3e115ca0aa89daf9466 (diff) | |
download | nextpnr-ec1eea9990152608c32614655ff315222fa11201.tar.gz nextpnr-ec1eea9990152608c32614655ff315222fa11201.tar.bz2 nextpnr-ec1eea9990152608c32614655ff315222fa11201.zip |
Fix assertion failure on invalid LOCATE input.
Trying to parse this invalid LPF syntax:
LOCATE COMP "a" SITE "A1"
IOBUF PORT "a" IO_TYPE=LVCMOS33;
(note missing semicolon on first line) gives an assertion failure in
strip_quotes, because the fifth token is scanned as "A1"IOBUF (without
a trailing quote).
Avoid the problem by detecting extraneous input and issuing a more
specific error.
-rw-r--r-- | ecp5/lpf.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ecp5/lpf.cc b/ecp5/lpf.cc index ceb1d7ae..e626cc54 100644 --- a/ecp5/lpf.cc +++ b/ecp5/lpf.cc @@ -101,6 +101,8 @@ bool Arch::applyLPF(std::string filename, std::istream &in) if (words.at(3) != "SITE") log_error("expected 'SITE' after 'LOCATE COMP %s' (on line %d)\n", cell.c_str(), lineno); auto fnd_cell = cells.find(id(cell)); + if (words.size() > 5) + log_error("unexpected input following LOCATE clause (on line %d)\n", lineno); if (fnd_cell != cells.end()) { fnd_cell->second->attrs[id("LOC")] = strip_quotes(words.at(4)); } |