@@ -61,8 +61,6 @@ class goto_check_javat
61
61
enable_unsigned_overflow_check =
62
62
_options.get_bool_option (" unsigned-overflow-check" );
63
63
enable_conversion_check = _options.get_bool_option (" conversion-check" );
64
- enable_undefined_shift_check =
65
- _options.get_bool_option (" undefined-shift-check" );
66
64
enable_float_overflow_check =
67
65
_options.get_bool_option (" float-overflow-check" );
68
66
enable_simplify = _options.get_bool_option (" simplify" );
@@ -165,7 +163,6 @@ class goto_check_javat
165
163
void bounds_check_index (const index_exprt &, const guardt &);
166
164
void div_by_zero_check (const div_exprt &, const guardt &);
167
165
void mod_overflow_check (const mod_exprt &, const guardt &);
168
- void undefined_shift_check (const shift_exprt &, const guardt &);
169
166
170
167
// / Generates VCCs for the validity of the given dereferencing operation.
171
168
// / \param expr the expression to be checked
@@ -224,7 +221,6 @@ class goto_check_javat
224
221
bool enable_unsigned_overflow_check;
225
222
bool enable_pointer_overflow_check;
226
223
bool enable_conversion_check;
227
- bool enable_undefined_shift_check;
228
224
bool enable_float_overflow_check;
229
225
bool enable_simplify;
230
226
bool enable_nan_check;
@@ -289,73 +285,6 @@ void goto_check_javat::div_by_zero_check(
289
285
guard);
290
286
}
291
287
292
- void goto_check_javat::undefined_shift_check (
293
- const shift_exprt &expr,
294
- const guardt &guard)
295
- {
296
- if (!enable_undefined_shift_check)
297
- return ;
298
-
299
- // Undefined for all types and shifts if distance exceeds width,
300
- // and also undefined for negative distances.
301
-
302
- const typet &distance_type = expr.distance ().type ();
303
-
304
- if (distance_type.id () == ID_signedbv)
305
- {
306
- binary_relation_exprt inequality (
307
- expr.distance (), ID_ge, from_integer (0 , distance_type));
308
-
309
- add_guarded_property (
310
- inequality,
311
- " shift distance is negative" ,
312
- " undefined-shift" ,
313
- expr.find_source_location (),
314
- expr,
315
- guard);
316
- }
317
-
318
- const typet &op_type = expr.op ().type ();
319
-
320
- if (op_type.id () == ID_unsignedbv || op_type.id () == ID_signedbv)
321
- {
322
- exprt width_expr =
323
- from_integer (to_bitvector_type (op_type).get_width (), distance_type);
324
-
325
- add_guarded_property (
326
- binary_relation_exprt (expr.distance (), ID_lt, std::move (width_expr)),
327
- " shift distance too large" ,
328
- " undefined-shift" ,
329
- expr.find_source_location (),
330
- expr,
331
- guard);
332
-
333
- if (op_type.id () == ID_signedbv && expr.id () == ID_shl)
334
- {
335
- binary_relation_exprt inequality (
336
- expr.op (), ID_ge, from_integer (0 , op_type));
337
-
338
- add_guarded_property (
339
- inequality,
340
- " shift operand is negative" ,
341
- " undefined-shift" ,
342
- expr.find_source_location (),
343
- expr,
344
- guard);
345
- }
346
- }
347
- else
348
- {
349
- add_guarded_property (
350
- false_exprt (),
351
- " shift of non-integer type" ,
352
- " undefined-shift" ,
353
- expr.find_source_location (),
354
- expr,
355
- guard);
356
- }
357
- }
358
-
359
288
// / check a mod expression for the case INT_MIN % -1
360
289
void goto_check_javat::mod_overflow_check (
361
290
const mod_exprt &expr,
@@ -1428,11 +1357,9 @@ void goto_check_javat::check_rec(const exprt &expr, guardt &guard)
1428
1357
{
1429
1358
check_rec_div (to_div_expr (expr), guard);
1430
1359
}
1431
- else if (expr.id () == ID_shl || expr. id () == ID_ashr || expr. id () == ID_lshr )
1360
+ else if (expr.id () == ID_shl)
1432
1361
{
1433
- undefined_shift_check (to_shift_expr (expr), guard);
1434
-
1435
- if (expr.id () == ID_shl && expr.type ().id () == ID_signedbv)
1362
+ if (expr.type ().id () == ID_signedbv)
1436
1363
integer_overflow_check (expr, guard);
1437
1364
}
1438
1365
else if (expr.id () == ID_mod)
0 commit comments