@@ -61,8 +61,6 @@ class goto_check_javat
6161 enable_unsigned_overflow_check =
6262 _options.get_bool_option (" unsigned-overflow-check" );
6363 enable_conversion_check = _options.get_bool_option (" conversion-check" );
64- enable_undefined_shift_check =
65- _options.get_bool_option (" undefined-shift-check" );
6664 enable_float_overflow_check =
6765 _options.get_bool_option (" float-overflow-check" );
6866 enable_simplify = _options.get_bool_option (" simplify" );
@@ -165,7 +163,6 @@ class goto_check_javat
165163 void bounds_check_index (const index_exprt &, const guardt &);
166164 void div_by_zero_check (const div_exprt &, const guardt &);
167165 void mod_overflow_check (const mod_exprt &, const guardt &);
168- void undefined_shift_check (const shift_exprt &, const guardt &);
169166
170167 // / Generates VCCs for the validity of the given dereferencing operation.
171168 // / \param expr the expression to be checked
@@ -224,7 +221,6 @@ class goto_check_javat
224221 bool enable_unsigned_overflow_check;
225222 bool enable_pointer_overflow_check;
226223 bool enable_conversion_check;
227- bool enable_undefined_shift_check;
228224 bool enable_float_overflow_check;
229225 bool enable_simplify;
230226 bool enable_nan_check;
@@ -289,73 +285,6 @@ void goto_check_javat::div_by_zero_check(
289285 guard);
290286}
291287
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-
359288// / check a mod expression for the case INT_MIN % -1
360289void goto_check_javat::mod_overflow_check (
361290 const mod_exprt &expr,
@@ -1428,11 +1357,9 @@ void goto_check_javat::check_rec(const exprt &expr, guardt &guard)
14281357 {
14291358 check_rec_div (to_div_expr (expr), guard);
14301359 }
1431- else if (expr.id () == ID_shl || expr. id () == ID_ashr || expr. id () == ID_lshr )
1360+ else if (expr.id () == ID_shl)
14321361 {
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)
14361363 integer_overflow_check (expr, guard);
14371364 }
14381365 else if (expr.id () == ID_mod)
0 commit comments