From d7a67d6d173c778e8de2d87b022632056ca2450a Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Wed, 28 Jan 2009 20:12:10 -0800 Subject: [PATCH] Better error message about part selects on invalid objects. Not all identifier types may have a part select, even when a bit select is OK. Better handle that case. --- netmisc.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/netmisc.cc b/netmisc.cc index 6131139f5..05579dfa8 100644 --- a/netmisc.cc +++ b/netmisc.cc @@ -333,6 +333,13 @@ hname_t eval_path_component(Design*des, NetScope*scope, const index_component_t&index = comp.index.front(); + if (index.sel != index_component_t::SEL_BIT) { + cerr << index.msb->get_fileline() << ": error: " + << "Part select is not valid for this kind of object." << endl; + des->errors += 1; + return hname_t(comp.name, 0); + } + // The parser will assure that path components will have only // bit select index expressions. For example, "foo[n]" is OK, // but "foo[n:m]" is not.