1616
1717/* ******************************************************************\
1818
19- Function: verilog_typecheck_exprt::array_type
19+ Function: verilog_typecheck_exprt::unpacked_array_type
2020
2121 Inputs:
2222
@@ -26,8 +26,9 @@ Function: verilog_typecheck_exprt::array_type
2626
2727\*******************************************************************/
2828
29- array_typet
30- verilog_typecheck_exprt::array_type (const irept &src, const typet &element_type)
29+ array_typet verilog_typecheck_exprt::unpacked_array_type (
30+ const typet &src,
31+ const typet &element_type)
3132{
3233 // int whatnot[x:y];
3334 // 'src' is yet to be converted, but 'element_type' is already converted.
@@ -57,13 +58,14 @@ verilog_typecheck_exprt::array_type(const irept &src, const typet &element_type)
5758 offset = 0 ;
5859 if (size < 0 )
5960 {
61+ // The size must be positive. 1800-2017 7.4.2
6062 throw errort ().with_location (size_expr.find_source_location ())
6163 << " array size must be nonnegative" ;
6264 }
6365 }
6466 else
6567 {
66- throw errort () << " array must have range or size" ;
68+ throw errort () << " unpacked array must have range or size" ;
6769 }
6870
6971 const typet src_subtype =
@@ -77,7 +79,7 @@ verilog_typecheck_exprt::array_type(const irept &src, const typet &element_type)
7779 if (src_subtype.is_nil ())
7880 array_subtype = element_type;
7981 else
80- array_subtype = array_type (src_subtype, element_type);
82+ array_subtype = unpacked_array_type (src_subtype, element_type);
8183
8284 const exprt final_size_expr = from_integer (size, integer_typet ());
8385 array_typet result (array_subtype, final_size_expr);
0 commit comments