File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
regression/smv/range-type Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 1+ CORE
2+ empty.smv
3+
4+ ^file empty\.smv line 4: range is empty$
5+ ^EXIT=2$
6+ ^SIGNAL=0$
7+ --
Original file line number Diff line number Diff line change 1+ MODULE main
2+
3+ -- wrong order
4+ VAR x : 10..1;
5+
Original file line number Diff line number Diff line change @@ -472,8 +472,14 @@ smv_ranget smv_typecheckt::convert_type(const typet &src)
472472 }
473473 else if (src.id ()==ID_range)
474474 {
475- dest.from =string2integer (src.get_string (ID_from));
476- dest.to =string2integer (src.get_string (ID_to));
475+ auto from = string2integer (src.get_string (ID_from));
476+ auto to = string2integer (src.get_string (ID_to));
477+
478+ if (from > to)
479+ throw errort ().with_location (src.source_location ()) << " range is empty" ;
480+
481+ dest.from = from;
482+ dest.to = to;
477483 }
478484 else if (src.id ()==ID_enumeration)
479485 {
@@ -1232,6 +1238,10 @@ void smv_typecheckt::convert(smv_parse_treet::mc_varst &vars)
12321238 {
12331239 const smv_parse_treet::mc_vart &var = var_it.second ;
12341240
1241+ // check the type, if given
1242+ if (var.type .is_not_nil () && var.type .id () != " submodule" )
1243+ convert_type (var.type );
1244+
12351245 symbol.base_name = var_it.first ;
12361246
12371247 if (var.identifier ==" " )
You can’t perform that action at this time.
0 commit comments