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)
237 lhs.
type().
id() == ID_struct
252 std::set<exprt> lhs_set=cba.
aliases(lhs, from);
256 for(
const auto &lhs_alias : lhs_set)
262 if(lhs.
type().
id()==ID_pointer)
279 locationt from{trace_from->current_location()};
280 locationt to{trace_to->current_location()};
288 switch(instruction.
type())
297 const auto &decl_symbol = instruction.
decl_symbol();
301 if(decl_symbol.type().id() == ID_pointer)
318 if(
function.
id()==ID_symbol)
348 if(lhs.
type().
id()==ID_pointer)
376 std::set<exprt> lhs_set=cba.
aliases(deref, from);
378 for(
const auto &l : lhs_set)
386 else if(identifier==
"memcpy" ||
387 identifier==
"memmove")
402 if(function_from != function_to)
407 code_function_callt::argumentst::const_iterator arg_it =
409 for(
const auto ¶m : code_type.
parameters())
411 const irep_idt &p_identifier=param.get_identifier();
412 if(p_identifier.
empty())
422 std::set<exprt> lhs_set=cba.
aliases(p, from);
426 for(
const auto &lhs : lhs_set)
432 if(p.
type().
id()==ID_pointer)
449 const auto &code = instruction.
get_other();
450 const irep_idt &statement = code.get_statement();
453 statement == ID_set_may || statement == ID_set_must ||
454 statement == ID_clear_may || statement == ID_clear_must)
457 code.operands().size() == 2,
"set/clear_may/must has two operands");
464 if(statement == ID_set_must)
466 else if(statement == ID_clear_must)
468 else if(statement == ID_set_may)
470 else if(statement == ID_clear_may)
477 if(lhs.
type().
id()==ID_pointer)
485 for(bitst::iterator b_it=
may_bits.begin();
495 for(bitst::iterator b_it=
must_bits.begin();
509 std::set<exprt> lhs_set=cba.
aliases(deref, from);
511 for(
const auto &l : lhs_set)
528 if(to!=from->get_target())
540 DATA_INVARIANT(
false,
"Exceptions must be removed before analysis");
543 DATA_INVARIANT(
false,
"SET_RETURN_VALUE must be removed before analysis");
557 DATA_INVARIANT(
false,
"Only complete instructions can be analyzed");
578 out << bit.first <<
" MAY:";
581 for(
unsigned i=0; b!=0; i++, b>>=1)
594 out << bit.first <<
" MUST:";
597 for(
unsigned i=0; b!=0; i++, b>>=1)
618 bitst::iterator it=
may_bits.begin();
621 while(it!=
may_bits.end() && it->first<bit.first)
623 if(it==
may_bits.end() || bit.first<it->first)
644 while(it!=
must_bits.end() && it->first<bit.first)
649 if(it==
must_bits.end() || bit.first<it->first)
676 for(bitst::iterator a_it=bits.begin();
681 a_it=bits.erase(a_it);
689 if(src.
id() == ID_get_must || src.
id() == ID_get_may)
692 for(
const auto &op : src.
operands())
705 if(src.
id() == ID_get_must || src.
id() == ID_get_may)
714 if(pointer.
type().
id()!=ID_pointer)
721 if(src.
id() == ID_get_may)
724 if(
get_bit(bit.second, bit_nr))
729 else if(src.
id() == ID_get_must)
743 if(src.
id() == ID_get_must)
745 else if(src.
id() == ID_get_may)
761 *it=
eval(*it, custom_bitvector_analysis);
776 unsigned pass=0, fail=0, unknown=0;
780 if(!gf_entry.second.body.has_assertion())
784 if(gf_entry.first ==
"__actual_thread_spawn")
788 out <<
"******** Function " << gf_entry.first <<
'\n';
795 if(i_it->is_assert())
802 if(
operator[](i_it).has_values.is_false())
805 exprt tmp =
eval(i_it->condition(), i_it);
809 description = i_it->source_location().get_comment();
816 out <<
"<result status=\"";
824 out <<
xml(i_it->source_location());
825 out <<
"<description>"
827 <<
"</description>\n";
828 out <<
"</result>\n\n";
832 out << i_it->source_location();
833 if(!description.
empty())
834 out <<
", " << description;
837 out <<
from_expr(ns, gf_entry.first, result);
854 out <<
"SUMMARY: " << pass <<
" pass, " << fail <<
" fail, "
855 << unknown <<
" unknown\n";
static exprt guard(const exprt::operandst &guards, exprt cond)
This is the basic interface of the abstract interpreter with default implementations of the core func...
goto_programt::const_targett locationt
ai_history_baset::trace_ptrt trace_ptrt
goto_programt::const_targett locationt
const parameterst & parameters() const
std::set< exprt > aliases(const exprt &, locationt loc)
local_may_alias_factoryt local_may_alias_factory
exprt eval(const exprt &src, locationt loc)
void check(const goto_modelt &, bool xml, std::ostream &)
void instrument(goto_functionst &)
unsigned get_bit_nr(const exprt &)
void set_bit(const exprt &, unsigned bit_nr, modet)
unsigned long long bit_vectort
bool merge(const custom_bitvector_domaint &b, trace_ptrt from, trace_ptrt to)
std::map< irep_idt, bit_vectort > bitst
static irep_idt object2id(const exprt &)
void assign_struct_rec(locationt from, const exprt &lhs, const exprt &rhs, custom_bitvector_analysist &, const namespacet &)
static bool has_get_must_or_may(const exprt &)
vectorst get_rhs(const exprt &) const
static void clear_bit(bit_vectort &dest, unsigned bit_nr)
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...
void output(std::ostream &out, const ai_baset &ai, const namespacet &ns) const final override
void assign_lhs(const exprt &, const vectorst &)
void erase_blank_vectors(bitst &)
erase blank bitvectors
static bool get_bit(const bit_vectort src, unsigned bit_nr)
void make_bottom() final override
no states
exprt eval(const exprt &src, custom_bitvector_analysist &) const
Operator to dereference a pointer.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
bool is_true() const
Return whether the expression is a constant representing true.
bool is_false() const
Return whether the expression is a constant representing false.
typet & type()
Return the type of the expression.
bool is_constant() const
Return whether the expression is a constant.
The Boolean constant false.
A collection of goto functions.
function_mapt function_map
symbol_tablet symbol_table
Symbol table.
goto_functionst goto_functions
GOTO functions.
This class represents an instruction in the GOTO intermediate representation.
const exprt & condition() const
Get the condition of gotos, assume, assert.
const exprt & call_function() const
Get the function that is called for FUNCTION_CALL.
const goto_instruction_codet & get_other() const
Get the statement for OTHER.
const exprt & assign_rhs() const
Get the rhs of the assignment for ASSIGN.
const symbol_exprt & dead_symbol() const
Get the symbol for DEAD.
const symbol_exprt & decl_symbol() const
Get the declared symbol for DECL.
const exprt & assign_lhs() const
Get the lhs of the assignment for ASSIGN.
goto_program_instruction_typet type() const
What kind of instruction?
const exprt::operandst & call_arguments() const
Get the arguments of a FUNCTION_CALL.
const irep_idt & id() const
std::set< exprt > get(const goto_programt::const_targett t, const exprt &src) const
Extract member of struct or union.
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
number_type number(const key_type &a)
Structure type, corresponds to C style structs.
const componentst & components() const
Expression to hold a symbol (variable)
const irep_idt & get_identifier() const
The Boolean constant true.
const char * to_string() const
Field-insensitive, location-sensitive bitvector analysis.
#define Forall_operands(it, expr)
exprt boolean_negate(const exprt &src)
negate a Boolean expression, possibly removing a not_exprt, and swapping false and true
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...
Deprecated expression utility functions.
#define forall_goto_program_instructions(it, program)
const std::string & id2string(const irep_idt &d)
std::string from_expr(const namespacet &ns, const irep_idt &identifier, const exprt &expr)
API to expression classes for Pointers.
const dereference_exprt & to_dereference_expr(const exprt &expr)
Cast an exprt to a dereference_exprt.
const address_of_exprt & to_address_of_expr(const exprt &expr)
Cast an exprt to an address_of_exprt.
xmlt xml(const irep_idt &property_id, const property_infot &property_info)
exprt simplify_expr(exprt src, const namespacet &ns)
#define UNREACHABLE
This should be used to mark dead code.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.
const string_constantt & to_string_constant(const exprt &expr)