Go to the documentation of this file.
61 if(src.
id()==ID_symbol)
65 else if(src.
id()==ID_dereference)
69 if(op.
id()==ID_address_of)
73 else if(op.
id()==ID_typecast)
92 else if(src.
id()==ID_member)
95 const exprt &op=m.compound();
105 else if(src.
id()==ID_typecast)
142 bitst::const_iterator may_it=
may_bits.find(identifier);
146 bitst::const_iterator must_it=
must_bits.find(identifier);
156 if(rhs.
id()==ID_symbol ||
157 rhs.
id()==ID_dereference)
162 else if(rhs.
id()==ID_typecast)
166 else if(rhs.
id()==ID_if)
171 return merge(v_true, v_false);
178 const exprt &string_expr)
180 if(string_expr.
id()==ID_typecast)
182 else if(string_expr.
id()==ID_address_of)
184 else if(string_expr.
id()==ID_index)
186 else if(string_expr.
id()==ID_string_constant)
196 if(src.
id()==ID_symbol)
198 std::set<exprt> result;
202 else if(src.
id()==ID_dereference)
206 const std::set<exprt> alias_set =
209 std::set<exprt> result;
211 for(
const auto &alias : alias_set)
212 if(alias.type().id() == ID_pointer)
219 else if(src.
id()==ID_typecast)
224 return std::set<exprt>();
234 if(lhs.
type().
id() == ID_struct || lhs.
type().
id() == ID_struct_tag)
250 std::set<exprt> lhs_set=cba.
aliases(lhs, from);
254 for(
const auto &lhs_alias : lhs_set)
260 if(lhs.
type().
id()==ID_pointer)
277 locationt from{trace_from->current_location()};
278 locationt to{trace_to->current_location()};
286 switch(instruction.
type())
295 const auto &decl_symbol = instruction.
decl_symbol();
299 if(decl_symbol.type().id() == ID_pointer)
316 if(
function.
id()==ID_symbol)
346 if(lhs.
type().
id()==ID_pointer)
374 std::set<exprt> lhs_set=cba.
aliases(deref, from);
376 for(
const auto &l : lhs_set)
384 else if(identifier==
"memcpy" ||
385 identifier==
"memmove")
400 if(function_from != function_to)
405 code_function_callt::argumentst::const_iterator arg_it =
407 for(
const auto ¶m : code_type.
parameters())
409 const irep_idt &p_identifier=param.get_identifier();
410 if(p_identifier.
empty())
420 std::set<exprt> lhs_set=cba.
aliases(p, from);
424 for(
const auto &lhs : lhs_set)
430 if(p.
type().
id()==ID_pointer)
447 const auto &code = instruction.
get_other();
448 const irep_idt &statement = code.get_statement();
451 statement == ID_set_may || statement == ID_set_must ||
452 statement == ID_clear_may || statement == ID_clear_must)
455 code.operands().size() == 2,
"set/clear_may/must has two operands");
462 if(statement == ID_set_must)
464 else if(statement == ID_clear_must)
466 else if(statement == ID_set_may)
468 else if(statement == ID_clear_may)
475 if(lhs.
type().
id()==ID_pointer)
483 for(bitst::iterator b_it=
may_bits.begin();
493 for(bitst::iterator b_it=
must_bits.begin();
507 std::set<exprt> lhs_set=cba.
aliases(deref, from);
509 for(
const auto &l : lhs_set)
526 if(to!=from->get_target())
538 DATA_INVARIANT(
false,
"Exceptions must be removed before analysis");
541 DATA_INVARIANT(
false,
"SET_RETURN_VALUE must be removed before analysis");
555 DATA_INVARIANT(
false,
"Only complete instructions can be analyzed");
576 out << bit.first <<
" MAY:";
579 for(
unsigned i=0; b!=0; i++, b>>=1)
592 out << bit.first <<
" MUST:";
595 for(
unsigned i=0; b!=0; i++, b>>=1)
616 bitst::iterator it=
may_bits.begin();
619 while(it!=
may_bits.end() && it->first<bit.first)
621 if(it==
may_bits.end() || bit.first<it->first)
642 while(it!=
must_bits.end() && it->first<bit.first)
647 if(it==
must_bits.end() || bit.first<it->first)
674 for(bitst::iterator a_it=bits.begin();
679 a_it=bits.erase(a_it);
687 if(src.
id() == ID_get_must || src.
id() == ID_get_may)
701 if(src.
id() == ID_get_must || src.
id() == ID_get_may)
710 if(pointer.
type().
id()!=ID_pointer)
717 if(src.
id() == ID_get_may)
720 if(
get_bit(bit.second, bit_nr))
725 else if(src.
id() == ID_get_must)
739 if(src.
id() == ID_get_must)
741 else if(src.
id() == ID_get_may)
757 *it=
eval(*it, custom_bitvector_analysis);
772 unsigned pass=0, fail=0, unknown=0;
776 if(!gf_entry.second.body.has_assertion())
780 if(gf_entry.first ==
"__actual_thread_spawn")
784 out <<
"******** Function " << gf_entry.first <<
'\n';
791 if(i_it->is_assert())
798 if(
operator[](i_it).has_values.is_false())
801 exprt tmp =
eval(i_it->condition(), i_it);
805 description = i_it->source_location().get_comment();
812 out <<
"<result status=\"";
820 out <<
xml(i_it->source_location());
821 out <<
"<description>"
823 <<
"</description>\n";
824 out <<
"</result>\n\n";
828 out << i_it->source_location();
829 if(!description.
empty())
830 out <<
", " << description;
833 out <<
from_expr(ns, gf_entry.first, result);
850 out <<
"SUMMARY: " << pass <<
" pass, " << fail <<
" fail, "
851 << unknown <<
" unknown\n";
#define UNREACHABLE
This should be used to mark dead code.
const componentst & components() const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
void assign_lhs(const exprt &, const vectorst &)
static irep_idt object2id(const exprt &)
bool merge(const custom_bitvector_domaint &b, trace_ptrt from, trace_ptrt to)
#define Forall_operands(it, expr)
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const goto_instruction_codet & get_other() const
Get the statement for OTHER.
const dereference_exprt & to_dereference_expr(const exprt &expr)
Cast an exprt to a dereference_exprt.
goto_programt::const_targett locationt
void assign_struct_rec(locationt from, const exprt &lhs, const exprt &rhs, custom_bitvector_analysist &, const namespacet &)
void erase_blank_vectors(bitst &)
erase blank bitvectors
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
Operator to dereference a pointer.
vectorst get_rhs(const exprt &) const
const string_constantt & to_string_constant(const exprt &expr)
Base class for all expressions.
exprt eval(const exprt &src, locationt loc)
void set_bit(const exprt &, unsigned bit_nr, modet)
void instrument(goto_functionst &)
std::set< exprt > aliases(const exprt &, locationt loc)
bool is_true() const
Return whether the expression is a constant representing true.
function_mapt function_map
Expression to hold a symbol (variable)
const symbol_exprt & decl_symbol() const
Get the declared symbol for DECL.
const exprt::operandst & call_arguments() const
Get the arguments of a FUNCTION_CALL.
ai_history_baset::trace_ptrt trace_ptrt
bool is_false() const
Return whether the expression is a constant representing false.
static void clear_bit(bit_vectort &dest, unsigned bit_nr)
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
typet & type()
Return the type of the expression.
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
goto_program_instruction_typet type() const
What kind of instruction?
void output(std::ostream &out, const ai_baset &ai, const namespacet &ns) const final override
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
const symbol_exprt & dead_symbol() const
Get the symbol for DEAD.
const std::string & id2string(const irep_idt &d)
xmlt xml(const irep_idt &property_id, const property_infot &property_info)
#define forall_operands(it, expr)
const irep_idt & get_identifier() const
exprt boolean_negate(const exprt &src)
negate a Boolean expression, possibly removing a not_exprt, and swapping false and true
exprt simplify_expr(exprt src, const namespacet &ns)
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const irep_idt & id() const
const char * to_string() const
The Boolean constant false.
const exprt & assign_rhs() const
Get the rhs of the assignment for ASSIGN.
const parameterst & parameters() const
Extract member of struct or union.
Deprecated expression utility functions.
A collection of goto functions.
static bool has_get_must_or_may(const exprt &)
goto_programt::const_targett locationt
std::set< exprt > get(const goto_programt::const_targett t, const exprt &src) const
unsigned long long bit_vectort
Structure type, corresponds to C style structs.
goto_functionst goto_functions
GOTO functions.
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
const exprt & assign_lhs() const
Get the lhs of the assignment for ASSIGN.
number_type number(const key_type &a)
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
bool is_constant() const
Return whether the expression is a constant.
local_may_alias_factoryt local_may_alias_factory
This is the basic interface of the abstract interpreter with default implementations of the core func...
exprt eval(const exprt &src, custom_bitvector_analysist &) const
void check(const goto_modelt &, bool xml, std::ostream &)
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
const exprt & condition() const
Get the condition of gotos, assume, assert.
const address_of_exprt & to_address_of_expr(const exprt &expr)
Cast an exprt to an address_of_exprt.
bool is_null_pointer(const constant_exprt &expr)
Returns true if expr has a pointer type and a value NULL; it also returns true when expr has value ze...
The Boolean constant true.
This class represents an instruction in the GOTO intermediate representation.
void transform(const irep_idt &function_from, trace_ptrt trace_from, const irep_idt &function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) final override
how function calls are treated: a) there is an edge from each call site to the function head b) there...
std::map< irep_idt, bit_vectort > bitst
symbol_tablet symbol_table
Symbol table.
std::string from_expr(const namespacet &ns, const irep_idt &identifier, const exprt &expr)
const exprt & call_function() const
Get the function that is called for FUNCTION_CALL.
#define forall_goto_program_instructions(it, program)
unsigned get_bit_nr(const exprt &)
static bool get_bit(const bit_vectort src, unsigned bit_nr)
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
void make_bottom() final override
no states