Skip to content

Commit d6da909

Browse files
Make flattening accept negative array sizes
If the specified array size is negative just do as if it was 0, this is similar to the case where the array size is not given.
1 parent 03026cb commit d6da909

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/solvers/flattening/boolbv_width.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
141141
if(total>(1<<30)) // realistic limit
142142
throw analysis_exceptiont("array too large for flattening");
143143

144-
entry.total_width = numeric_cast_v<std::size_t>(total);
144+
if(total < 0)
145+
entry.total_width = 0;
146+
else
147+
entry.total_width = numeric_cast_v<std::size_t>(total);
145148
}
146149
}
147150
else if(type_id==ID_vector)

0 commit comments

Comments
 (0)