File tree 1 file changed +5
-12
lines changed
1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change 15
15
#include " c_types.h"
16
16
#include " format_expr.h"
17
17
#include " format_type.h"
18
+ #include " invariant.h"
18
19
#include " message.h"
19
20
#include " namespace.h"
20
21
#include " pointer_offset_size.h"
@@ -173,12 +174,8 @@ exprt expr_initializert<nondet>::expr_initializer_rec(
173
174
throw 0 ;
174
175
}
175
176
176
- if (array_size<0 )
177
- {
178
- error ().source_location =source_location;
179
- error () << " failed to initialize array with negative size" << eom;
180
- throw 0 ;
181
- }
177
+ DATA_INVARIANT (
178
+ array_size >= 0 , " array should not have negative size" );
182
179
183
180
array_exprt value (array_type);
184
181
value.operands ().resize (integer2unsigned (array_size), tmpval);
@@ -209,12 +206,8 @@ exprt expr_initializert<nondet>::expr_initializer_rec(
209
206
throw 0 ;
210
207
}
211
208
212
- if (vector_size<0 )
213
- {
214
- error ().source_location =source_location;
215
- error () << " failed to initialize vector with negative size" << eom;
216
- throw 0 ;
217
- }
209
+ DATA_INVARIANT (
210
+ vector_size >= 0 , " vector should not have negative size" );
218
211
219
212
vector_exprt value (vector_type);
220
213
value.operands ().resize (integer2unsigned (vector_size), tmpval);
You can’t perform that action at this time.
0 commit comments