Go to the documentation of this file.
66 if(t->has_condition())
69 checked.insert(t->location_number);
104 if(expr.
id()==ID_typecast)
108 if(typecast_expr.op().id() == ID_constant)
111 const typet &old_type = typecast_expr.op().type();
115 if(type.
id()==ID_signedbv)
117 if(old_type.
id()==ID_signedbv)
120 if(new_width >= old_width)
136 else if(old_type.
id()==ID_unsignedbv)
139 if(new_width >= old_width + 1)
151 else if(type.
id()==ID_unsignedbv)
153 if(old_type.
id()==ID_signedbv)
158 if(new_width < old_width - 1)
167 else if(old_type.
id()==ID_unsignedbv)
170 if(new_width>=old_width)
183 else if(expr.
id()==ID_div)
188 if(type.
id()==ID_signedbv)
194 cases.insert(
and_exprt(int_min_eq, minus_one_eq));
197 else if(expr.
id()==ID_unary_minus)
199 if(type.
id()==ID_signedbv)
208 else if(expr.
id()==ID_plus ||
209 expr.
id()==ID_minus ||
214 for(std::size_t i = 1; i < expr.
operands().size(); i++)
232 cases.insert(overflow);
245 for(expr_sett::iterator it=cases.begin();
285 assignment->swap(*t);
287 added.push_back(assignment);
#define Forall_goto_program_instructions(it, program)
const div_exprt & to_div_expr(const exprt &expr)
Cast an exprt to a div_exprt.
The type of an expression, extends irept.
Base class for all expressions.
A base class for binary expressions.
const bitvector_typet & to_bitvector_type(const typet &type)
Cast a typet to a bitvector_typet.
static instructiont make_assignment(const code_assignt &_code, const source_locationt &l=source_locationt::nil())
Create an assignment instruction.
std::list< targett > targetst
typet & type()
Return the type of the expression.
targett insert_before(const_targett target)
Insertion before the instruction pointed-to by the given instruction iterator target.
void accumulate_overflow(goto_programt::targett t, const exprt &expr, goto_programt::targetst &added)
#define forall_operands(it, expr)
A Boolean expression returning true, iff operation kind would result in an overflow when applied to o...
void compute_location_numbers(unsigned &nr)
Compute location numbers.
void fix_types(binary_exprt &overflow)
const unary_minus_exprt & to_unary_minus_expr(const exprt &expr)
Cast an exprt to a unary_minus_exprt.
std::unordered_set< exprt, irep_hash > expr_sett
const irep_idt & id() const
The Boolean constant false.
const signedbv_typet & to_signedbv_type(const typet &type)
Cast a typet to a signedbv_typet.
typet join_types(const typet &t1, const typet &t2)
Return the smallest type that both t1 and t2 can be cast to without losing information.
std::size_t get_width() const
const exprt & overflow_var
instructionst instructions
The list of instructions in the goto program.
std::set< unsigned > checked
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
A base class for relations, i.e., binary predicates whose two operands have the same type.
targett insert_after(const_targett target)
Insertion after the instruction pointed-to by the given instruction iterator target.
Semantic type conversion.
A goto_instruction_codet representing an assignment in the program.
const multi_ary_exprt & to_multi_ary_expr(const exprt &expr)
Cast an exprt to a multi_ary_exprt.
void overflow_expr(const exprt &expr, expr_sett &cases)
void add_overflow_checks()
instructionst::iterator targett
const code_assignt & to_code_assign(const goto_instruction_codet &code)