1#ifndef CPROVER_GOTO_SYMEX_GOTO_SYMEX_H
2#define CPROVER_GOTO_SYMEX_GOTO_SYMEX_H
61 std::shared_ptr<symex_targett> _target,
109 std::shared_ptr<symex_targett> t,
112 unsigned int simplified,
113 unsigned int truncations = 0)
262 bool block_assertions =
false);
287 statet::merge_state_listt::iterator )
303 bool &new_guard_true,
304 bool &new_guard_false,
390 virtual void claim(
const expr2tc &expr,
const std::string &msg);
402 const std::string &msg,
404 const std::string ¬e =
"");
497 void phi_function(
const statet::merge_statet &merge_state);
633 const irep_idt &function_identifier,
635 const std::vector<expr2tc> &arguments);
657 const std::string &symname);
798 const std::string &func);
810 unsigned long number_of_bytes,
813 uint64_t &avail_bytes,
814 bool rename_object =
true);
820 const std::string &func);
835 const std::string &bump_name);
1002 bool &old_is_array);
1014 const std::list<dereference_callbackt::internal_item> &old_objects,
1016 const expr2tc &new_elem_count,
1050 const expr2tc &old_base_array,
1072 const expr2tc &old_base_array,
1074 const expr2tc &old_elem_count,
1075 const expr2tc &new_elem_count,
1093 const std::string &name_prefix);
1161 const if2t &if_effect,
1178 const bool hidden =
false,
1440 const bool is_malloc,
1490 std::vector<expr2tc> &chars);
1531 bool &constant_args);
1547 std::list<expr2tc> &out);
1557 std::optional<renaming::level2t::name_record>
1561 std::vector<renaming::level2t::name_record>
1586 std::vector<renaming::level2t::name_record>
1746 std::map<irep_idt, std::vector<std::pair<std::vector<expr2tc>,
expr2tc>>>
1755 const std::vector<expr2tc> &arguments,
1862 const std::string &property,
1863 const std::string &msg,
1911 const size_t num_of_bytes,
1912 const size_t src_offset,
1913 const size_t dst_offset);
void base_type(type2tc &type, const namespacet &ns)
Definition base_type.cpp:6
static const twodig_t base
Definition bigint.cpp:28
type2tc get_bool_type()
Definition c_types.cpp:418
typet char_type()
Definition c_types.cpp:166
Definition irep2_expr.h:2007
Definition irep2_expr.h:2175
Definition irep2_expr.h:2034
Type of functions.
Definition irep2_type.h:333
Class providing interface to value set tracking code.
Definition dereference.h:96
Thread-aware symex state explored by reachability_treet.
Definition execution_state.h:46
Definition goto_functions.h:56
Container for an instruction of the goto-program.
Definition goto_program.h:95
instructionst::const_iterator const_targett
Definition goto_program.h:591
Stack frame tracking class.
Definition goto_symex_state.h:161
Class for storing a particular threads state.
Definition goto_symex_state.h:36
allocated_obj(const expr2tc &s, const guard2tc &g, const bool a, const std::string n)
Definition goto_symex.h:73
expr2tc obj
Symbol identifying the pointer that was allocated.
Definition goto_symex.h:82
std::string name
The object name.
Definition goto_symex.h:89
bool auto_deallocd
Record if the object is automatically desallocated (allocated with alloca).
Definition goto_symex.h:87
guard2tc alloc_guard
Guard when allocation occured.
Definition goto_symex.h:84
Class recording the outcome of symbolic execution.
Definition goto_symex.h:106
std::shared_ptr< symex_targett > target
Definition goto_symex.h:119
unsigned int simplified_claims
Definition goto_symex.h:122
symex_resultt(std::shared_ptr< symex_targett > t, unsigned int claims, unsigned int remain, unsigned int simplified, unsigned int truncations=0)
Definition goto_symex.h:108
unsigned int bounded_loop_truncations
Carried out of exploration rather than read back from live state: under –schedule the current frame i...
Definition goto_symex.h:126
unsigned int remaining_claims
Definition goto_symex.h:121
unsigned int total_claims
Definition goto_symex.h:120
Primay symbolic execution class.
Definition goto_symex.h:47
void intrinsic_get_object_size(const code_function_call2t &func_call, reachability_treet &art)
Returns the size of the object.
Definition object_size.cpp:204
irep_idt alloc_size_arr_name
Definition goto_symex.h:1735
void intrinsic_havoc_object(const code_function_call2t &call)
Perform havoc_object; assign nondet to every object the argument may point to, whole and of any size.
Definition memory_ops.cpp:1845
void invalidate_object(const expr2tc &ptr)
Clear the valid bit of the object ptr points to, with no free checks.
Definition memory_alloc.cpp:1057
void propagate_assume_equality(const expr2tc &the_assumption)
Lift var == const from an assume into the level2 constant propagator so subsequent renames of var sub...
Definition symex_main.cpp:220
bool resolve_dynamic_size_by_value_set(expr2tc &expr)
Size a heap object by its allocation, and an object with automatic or static storage by its type.
Definition symex_valid_object.cpp:150
bool forward_condition
Flag as to whether we're doing a k-induction forward condition.
Definition goto_symex.h:1823
static constexpr size_t max_copy_definition_nodes
Cap on one recorded copy definition's flattened node count: canonicalization doubles nested arithmeti...
Definition goto_symex.h:1634
void release_symex_caches()
Free what only symex reads, once a formula is built: the guard prefix index grows with every branchin...
Definition goto_symex.h:367
BigInt max_unwind
Global maximum number of unwinds.
Definition goto_symex.h:1716
void snapshot_interval_domain(statet::merge_statet &merge_state)
Record the online interval domain in a path being parked, so merge_interval_domain can join it back i...
Definition symex_goto.cpp:621
void check_stack_size(const expr2tc &expr, const std::string &subject="")
Account expr's storage against the current frame and claim that neither –stack-limit nor –total-stack...
Definition symex_stack.cpp:39
void record_frame_alloca(const expr2tc &lhs, const expr2tc &object, bool is_malloc)
Records an alloca'd object on the current frame, to die when it returns.
Definition memory_alloc.cpp:890
void intrinsic_switch_from_monitor(reachability_treet &art)
Context switch from the monitor thread.
Definition threads.cpp:245
void intrinsic_really_atomic_end(reachability_treet &art)
Really atomic start/end - atomic blocks that just disable ileaves.
Definition threads.cpp:223
void symex_assign_typecast(const expr2tc &lhs, const expr2tc &full_lhs, expr2tc &rhs, expr2tc &full_rhs, guard2tc &guard, const bool hidden)
Perform assignment to a typecast irep.
Definition symex_assign.cpp:682
std::vector< renaming::level2t::name_record > va_list_pointee_records(const expr2tc &va_list_expr) const
The l1 identity records of the local va_lists a pointer-valued expression may point to.
Definition va_arg.cpp:61
bool is_valid_object(const symbolt &symbol)
Decide if symbol is valid or not.
Definition symex_valid_object.cpp:249
virtual unsigned int & get_dynamic_counter()=0
Fetch reference to global dynamic object counter.
void bound_dynamic_object_size(const code_assign2t &code)
Bound at PTRDIFF_MAX the object size an assignment records, reporting a constant request that exceeds...
Definition memory_alloc.cpp:626
void bump_call(const code_function_call2t &func_call, const std::string &symname)
Definition run_builtin.cpp:15
expr2tc va_list_cursor(const expr2tc &va_list_expr)
The cursor symbol of a started local va_list; nil when its cursor is not known, and the frame's curso...
Definition va_arg.cpp:96
std::map< unsigned, std::pair< std::string, unsigned > > loop_id_to_func_index
Mapping global loop ID -> (function name, per-function loop index).
Definition goto_symex.h:1714
void symex_assign_symbol(const expr2tc &lhs, const expr2tc &full_lhs, expr2tc &rhs, expr2tc &full_rhs, guard2tc &guard, const bool hidden)
Perform assignment to a symbol.
Definition symex_assign.cpp:551
const goto_functionst & goto_functions
GOTO functions that we're operating over.
Definition goto_symex.h:1726
goto_symex_statet statet
Definition goto_symex.h:96
bool format_printf_output(const code_printf2t &call, size_t fmt_idx, printf_formattert &formatter, bool &constant_args)
Run formatter over an unrenamed printf-family call; false when the format is not a constant.
Definition io.cpp:223
std::list< dereference_callbackt::internal_item > internal_deref_items
Set of dereference state records; this field is used as a mailbox between the dereference code and th...
Definition goto_symex.h:1834
void symex_input(const code_function_call2t &expr)
Symbolic implementation of scanf and fscanf.
Definition io.cpp:1047
void intrinsic_register_monitor(const code_function_call2t &call, reachability_treet &art)
Register which thread is the monitor thread.
Definition threads.cpp:251
void replace_dynamic_size(expr2tc &expr)
Size the object DYNAMIC_SIZE names, falling back to the heap-only table.
Definition symex_valid_object.cpp:213
void analyze_old_object(const expr2tc &old_obj, type2tc &elem_type, expr2tc &old_base_array, bool &old_is_array)
Analyze an object a reallocated pointer may point to.
Definition memory_alloc.cpp:302
bool claim_skips_deferred
Set while claim() handles a Python assert's own condition, which needs no deferred assumption.
Definition goto_symex.h:1685
void symex_asprintf_buffer(const expr2tc &strp, const expr2tc &retval)
Point an asprintf/vasprintf call's strp at a fresh heap buffer of retval + 1 bytes,...
Definition io.cpp:607
bool resolve_by_value_set(expr2tc &expr, const expr2tc &ptr, const std::function< expr2tc(const expr2tc &)> &resolve)
A pointer reaching a check through a parameter or a local variable is a plain symbol,...
Definition symex_valid_object.cpp:84
void update_pointer_validity(const expr2tc &old_ptr, const expr2tc &alloc_fail, const guard2tc &guard)
Update pointer validity information after realloc.
Definition memory_alloc.cpp:477
std::map< irep_idt, std::vector< std::pair< std::vector< expr2tc >, expr2tc > > > uf_applications
Per-callee history of uninterpreted-function applications the SMT backend cannot encode natively,...
Definition goto_symex.h:1747
bool resolve_valid_object_by_value_set(expr2tc &expr, const expr2tc &obj_ref)
Decide VALID_OBJECT from the object the value set names, if it names one.
Definition symex_valid_object.cpp:129
void replace_races_check(expr2tc &expr)
Definition misc.cpp:12
friend class reachability_treet
Definition goto_symex.h:94
void symex_witness_assert(expr2tc &new_expr, const std::string &msg)
Definition witness.cpp:197
void merge_locality(const statet::merge_statet &merge_state)
Definition symex_goto.cpp:665
void symex_assign_extract(const expr2tc &lhs, const expr2tc &full_lhs, expr2tc &rhs, expr2tc &full_rhs, guard2tc &guard, const bool hidden)
Perform assignment to an extract irep.
Definition symex_assign.cpp:1032
bool symex_uninterpreted_function(const code_function_call2t &call, const irep_idt &identifier)
Model a call to a "__ESBMC_uninterpreted_*" or "__CPROVER_uninterpreted_*" function as a genuine unin...
Definition symex_function.cpp:429
virtual void record_parked_path(goto_programt::const_targett, statet::merge_state_listt::iterator)
Hook called when a step parks a merge_statet snapshot for a deferred merge — a GOTO forking off its s...
Definition goto_symex.h:285
bool handle_conditional(const expr2tc &lhs, const if2t &if_effect, const guard2tc &guard)
Handle conditional expressions (if2t) in the symbolic execution.
Definition symex_assign.cpp:337
bool va_list_is_started(const expr2tc &va_list_expr) const
Whether the va_list denoted by this expression is known (or assumed) to have been initialised by va_s...
Definition va_arg.cpp:73
void symex_assign_union(const expr2tc &lhs, const expr2tc &full_lhs, expr2tc &rhs, expr2tc &full_rhs, guard2tc &guard, const bool hidden)
Perform assignment to a union.
Definition symex_assign.cpp:666
virtual void symex_function_call_deref(const expr2tc &call)
Handle an indirect function call, to a pointer.
Definition symex_function.cpp:801
void symex_assign_if(const expr2tc &lhs, const expr2tc &full_lhs, expr2tc &rhs, expr2tc &full_rhs, guard2tc &guard, const bool hidden)
Perform assignment to an "if".
Definition symex_assign.cpp:878
void finalize_realloc_result(const expr2tc &lhs, const expr2tc &result, const expr2tc &new_array, const guard2tc &guard, const expr2tc &realloc_size, const expr2tc &alloc_fail)
Finalize the result of a realloc operation.
Definition memory_alloc.cpp:496
bool check_incremental(const expr2tc &expr, const std::string &msg)
Perform incremental SMT solving for assert and assume statements.
Definition symex_main.cpp:29
void default_replace_dynamic_allocation(expr2tc &expr)
Definition dynamic_allocation.cpp:73
bool recover_va_list_args(const code_printf2t &call, size_t fmt_idx, std::list< expr2tc > &out)
Recover the variadic arguments hidden behind a va_list operand of a v*printf-family call (vprintf/vfp...
Definition io.cpp:19
bool base_case
Flag as to whether we're doing a k-induction base case.
Definition goto_symex.h:1820
bool chase_copies(expr2tc &expr) const
Rewrite an expression onto the canonical basis of its copy chains: every L2 symbol with an entry in c...
Definition symex_goto.cpp:70
void intrinsic_switch_to_monitor(reachability_treet &art)
Context switch to the monitor thread.
Definition threads.cpp:228
void flush_deferred_assumptions()
Before a claim that needs them, emit every deferred assumption into the target equation.
Definition symex_main.cpp:300
unsigned total_claims
Number of assertions executed.
Definition goto_symex.h:1695
void intrinsic_spawn_thread(const code_function_call2t &call, reachability_treet &art)
Perform spawn_thread; Generates a new thread at a named function.
Definition threads.cpp:131
void intrinsic_memcmp(reachability_treet &art, const code_function_call2t &func_call)
Models __ESBMC_memcmp(s1, s2, n): for a constant n with both pointers resolving to concrete primitive...
Definition memory_ops.cpp:1291
std::map< unsigned, BigInt > unwind_set
Unwind bounds, loop number -> max unwinds.
Definition goto_symex.h:1709
bool no_assertions
Flag as to whether we're checking user assertions.
Definition goto_symex.h:1805
std::map< std::pair< std::string, unsigned >, BigInt > unwind_func_set
Unwind bounds by function name and per-function loop index (0-indexed), (function name,...
Definition goto_symex.h:1712
type2tc determine_fallback_element_type(const sideeffect2t &code, const expr2tc &lhs)
Determine fallback element type for realloc.
Definition memory_alloc.cpp:356
void intrinsic_terminate_thread(reachability_treet &art)
Perform terminate_thread; Record thread as terminated.
Definition threads.cpp:192
expr2tc calculate_element_count(const expr2tc &size_bytes, const expr2tc &elem_size)
Calculate number of elements from byte size.
Definition memory_alloc.cpp:373
expr2tc argument_value(const type2tc &arg_type, const expr2tc &rhs, const irep_idt &identifier)
Convert an actual argument to its parameter's type, claiming the call undefined when the two are inco...
Definition symex_function.cpp:187
void copy_memory_content(const expr2tc &old_base_array, const expr2tc &new_array, const expr2tc &old_elem_count, const expr2tc &new_elem_count, const type2tc &elem_type, bool old_is_array, const guard2tc &guard)
Copy memory content from old to new allocation.
Definition memory_alloc.cpp:119
void track_new_pointer(const expr2tc &ptr_obj, const type2tc &new_type, const guard2tc &guard, const expr2tc &size=expr2tc())
Pointer modelling update function.
Definition memory_alloc.cpp:902
void intrinsic_memset(reachability_treet &art, const code_function_call2t &func_call)
Intrinsic call for C memset function call.
Definition memory_ops.cpp:1652
void merge_interval_domain(const statet::merge_statet &merge_state)
Join a parked path's interval domain into the shared one; a path parked without a snapshot sends the ...
Definition symex_goto.cpp:652
void va_list_copy(const expr2tc &dst, const expr2tc &src)
va_copy: start dst as src is, reading where src reads next.
Definition va_arg.cpp:177
virtual void symex_step(reachability_treet &art)
Symbolically execute one instruction.
Definition symex_main.cpp:349
void intrinsic_kill_monitor(reachability_treet &art)
Terminate the monitor thread.
Definition threads.cpp:282
virtual unsigned int & get_nondet_counter()=0
Fetch reference to global nondet object counter.
void symex_assign_member(const expr2tc &lhs, const expr2tc &full_lhs, expr2tc &rhs, expr2tc &full_rhs, guard2tc &guard, const bool hidden)
Perform assignment to a struct.
Definition symex_assign.cpp:820
void va_list_mark_started(const expr2tc &va_list_expr, bool started, const expr2tc &cursor)
Record the started-by-va_start state of the va_list denoted by this expression, and the va_arg index ...
Definition va_arg.cpp:110
expr2tc symex_sprintf_store(const code_printf2t &call)
Store an unrenamed sprintf or snprintf call's output in its destination buffer, when the format bound...
Definition io.cpp:492
friend void build_goto_symex_classes()
persistent_map< expr2tc, size_t, irep2_hash > conjunct_indext
Rewritten conjunct -> position of the first conjunct rewriting to it.
Definition goto_symex.h:186
void symex_assign_array(const expr2tc &lhs, const expr2tc &full_lhs, expr2tc &rhs, expr2tc &full_rhs, guard2tc &guard, const bool hidden)
Perform assignment to an array.
Definition symex_assign.cpp:784
tvt::tv_enumt path_guard_decides(const expr2tc &new_guard, bool already_false, bool already_true)
Whether the accumulated path guard already decides a branch condition: TV_TRUE when a conjunct matche...
Definition symex_goto.cpp:144
persistent_map< irep_idt, expr2tc, irep_id_hash > guard_definitions
Defining condition of each L2 guard symbol generation, i.e.
Definition goto_symex.h:1648
void record_property_verdict(const std::string &msg, property_verdictt verdict, const std::string ¬e="")
Record a verdict for the claim being symbolically executed.
Definition symex_main.cpp:148
irep_idt valid_ptr_arr_name
Symbol names for modelling arrays.
Definition goto_symex.h:1735
unsigned bounded_loop_truncations
Loops cut off at the unwinding bound with no unwinding assertion to flag it, i.e.
Definition goto_symex.h:1705
void symex_free(const expr2tc &expr)
Symbolic implementation of free.
Definition memory_alloc.cpp:953
void symex_witness_function_return(expr2tc ret_val, const irep_idt &call_line)
Definition witness.cpp:31
void simplify_python_builtins(expr2tc &expr)
Definition python_builtins.cpp:145
bool get_unwind(const symex_targett::sourcet &source, const BigInt &unwind)
Test whether unwinding bound has been exceeded.
Definition symex_goto.cpp:871
bool run_next_function_ptr_target(bool first)
Setup next function in a chain of func ptr calls.
Definition symex_function.cpp:992
bool validate_witness
Cached from –validate-violation-witness; checked on every branch/intrinsic.
Definition goto_symex.h:1829
void symex_assign_structure(const expr2tc &lhs, const expr2tc &full_lhs, expr2tc &rhs, expr2tc &full_rhs, guard2tc &guard, const bool hidden)
Perform assignment to a structure.
Definition symex_assign.cpp:609
std::unordered_map< renaming::level2t::name_record, bool, renaming::level2t::name_rec_hash > va_started
Level-1 identities (base name, activation, thread) of va_list objects initialised by va_start,...
Definition goto_symex.h:1773
void merge_value_sets(const statet::merge_statet &merge_state)
Merge pointer tracking value sets in a phi function.
Definition symex_goto.cpp:688
void replace_valid_object(expr2tc &expr)
Decide VALID_OBJECT / DEALLOCATED_OBJ against the object the pointer names.
Definition symex_valid_object.cpp:173
bool k_induction
Flag as to whether we're doing a k-induction.
Definition goto_symex.h:1817
virtual void assume(const expr2tc &assumption)
Perform an assumption.
Definition symex_main.cpp:256
void symex_decl(const expr2tc &code)
Interpret an DECL instruction.
Definition symex_other.cpp:72
void symex_cpp_delete(const expr2tc &code)
Symbolic implementation of c++'s delete.
Definition cpp_memory.cpp:82
conjunct_indext prefix_index(const guard2tc &guard)
The conjunct index of guard, which must not be true.
Definition symex_goto.cpp:167
void intrinsic_get_thread_id(const code_function_call2t &call, reachability_treet &art)
Perform get_thread_id; return the current thread identifier.
Definition threads.cpp:58
unsigned long depth_limit
Depth limit, as given by the –depth option.
Definition goto_symex.h:1791
bool no_return_value_opt
Disable return value optimization.
Definition goto_symex.h:1783
void handle_sideeffect(const expr2tc &lhs, const sideeffect2t &effect, const guard2tc &guard)
Handle side effects in the symbolic execution.
Definition symex_assign.cpp:267
bool memory_leak_check
Flag as to whether we're performing memory leak checks.
Definition goto_symex.h:1798
void replace_dynamic_allocation(expr2tc &expr)
Replace ireps regarding dynamic allocations with code.
Definition symex_valid_object.cpp:219
void symex_va_arg(const expr2tc &lhs, const sideeffect2t &code, const guard2tc &guard)
Symbolic implementation of va_arg.
Definition va_arg.cpp:195
virtual void analyze_args(const expr2tc &expr)=0
Analyze the shared varables in a function call, this is because an argumemt may be renamed to constan...
void symex_end_of_function()
End a functions interpretation.
Definition symex_function.cpp:1141
goto_symex_statet::framet & va_list_frame(const expr2tc &va_list_expr)
The frame whose variadic arguments a va_list reads: the activation that declared it,...
Definition va_arg.cpp:168
void intrinsic_builtin_object_size(const code_function_call2t &func_call, reachability_treet &art)
Implements GCC's __builtin_object_size intrinsic for object size determination.
Definition object_size.cpp:99
virtual void claim(const expr2tc &expr, const std::string &msg)
Perform an assertion.
Definition symex_main.cpp:68
std::shared_ptr< symex_targett > target
Target listening to the execution trace.
Definition goto_symex.h:1728
bool is_python_gc_object(const symbolt *base) const
Whether base is a user-defined Python class instance that follows garbage-collected lifetime semantic...
Definition symex_function.cpp:1053
std::unordered_map< irep_idt, expr2tc > dynamic_object_sizes
The renamed byte size each heap object was allocated with, by symbol.
Definition goto_symex.h:1690
expr2tc create_result_pointer(const expr2tc &new_array, const type2tc &lhs_type)
Create result pointer from newly allocated array.
Definition memory_alloc.cpp:418
bool symex_witness_function_enter(const irep_idt &call_line)
Definition witness.cpp:70
expr2tc va_list_cursor_symbol(const renaming::level2t::name_record &rec)
The l1 symbol holding the va_arg index a local va_list reads next.
Definition va_arg.cpp:80
void merge_gotos()
Merge converging states into current state.
Definition symex_goto.cpp:569
expr2tc string_length(const expr2tc &ptr, size_t &max_len)
The characters a s conversion prints for the unrenamed char pointer ptr, adding its largest value to ...
Definition io.cpp:338
void intrinsic_set_thread_data(const code_function_call2t &call, reachability_treet &art)
Perform set_thread_state; store thread startup information.
Definition threads.cpp:74
irep_idt dyn_info_arr_name
Definition goto_symex.h:1735
bool run_builtin(const code_function_call2t &call, const std::string &symname)
Run a builtin, something prefixed with __builtin.
Definition run_builtin.cpp:201
optionst & options
Options we're working with.
Definition goto_symex.h:1621
void symex_assume()
Interpret an ASSUME instruction.
Definition symex_main.cpp:561
persistent_map< irep_idt, expr2tc, irep_id_hash > copy_definitions
Copy chains between L2 symbol generations: lhs generation -> the stable value it was unconditionally ...
Definition goto_symex.h:1663
void loop_bound_exceeded(const expr2tc &guard)
Encode unwinding assertions and assumption.
Definition symex_goto.cpp:838
unsigned remaining_claims
Number of assertions remaining to be discharged.
Definition goto_symex.h:1697
unsigned long stack_limit
Limit size, in bits, for a single stack frame.
Definition goto_symex.h:1785
void symex_assign_bitfield(const expr2tc &lhs, const expr2tc &full_lhs, expr2tc &rhs, expr2tc &full_rhs, guard2tc &guard, const bool hidden)
This method is used when we need to assign a value to a struct bitfield which is obtained via applyin...
Definition symex_assign.cpp:1093
void intrinsic_init_thread_local(reachability_treet &art)
Perform init_thread_local; seeds each __thread-qualified global to its static initializer in the acti...
Definition threads.cpp:199
void symex_assign_rec(const expr2tc &lhs, const expr2tc &full_lhs, expr2tc &rhs, expr2tc full_rhs, guard2tc &guard, const bool hidden)
Recursively perform symex assign.
Definition symex_assign.cpp:484
bool no_simplify
Flag as to whether we're not simplifying exprs.
Definition goto_symex.h:1808
unsigned long break_insn
Instruction number we are to break at – that is, trap, to the debugger.
Definition goto_symex.h:1795
void symex_cpp_new(const expr2tc &lhs, const sideeffect2t &code, const guard2tc &guard)
Symbolic implementation of c++'s new.
Definition cpp_memory.cpp:13
void intrinsic_memmove(reachability_treet &art, const code_function_call2t &func_call)
Models __ESBMC_memmove.
Definition memory_ops.cpp:1193
bool stack_checks_enabled() const
True when either stack limit is on.
Definition goto_symex.h:335
void memcpy_finish(const code_function_call2t &func_call, const expr2tc &dst_arg, const expr2tc &src_arg, const expr2tc &n_arg)
The NULL checks and return-value assignment shared by both of intrinsic_memcpy_impl's paths.
Definition memory_ops.cpp:859
virtual void symex_printf(const expr2tc &lhs, expr2tc &code)
Symbolic implementation of printf.
Definition io.cpp:650
bool is_assume_false(const expr2tc &assumption)
Incrementally check the assumption.
Definition symex_main.cpp:192
void record_copy_definition(const expr2tc &renamed_lhs, const expr2tc &rhs)
Record a copy chain for chase_copies after an unconditional assignment, when the rhs is a stable valu...
Definition symex_goto.cpp:93
void intrinsic_switch_to(const code_function_call2t &c, reachability_treet &art)
Perform switch_to; switches control to explicit thread ID.
Definition threads.cpp:24
void pop_frame()
Pop a stack frame.
Definition symex_function.cpp:1086
persistent_map< expr2tc, conjunct_indext, irep2_hash > guard_prefix_index
prefix_index's result per and-chain node of a path guard.
Definition goto_symex.h:1672
void dereference(expr2tc &expr, dereferencet::modet mode, bool block_assertions=false)
Dereference an expression.
Definition symex_dereference.cpp:219
std::vector< deferred_assumptiont > deferred_assumptions
Assumptions defer_assumption() holds back, in program order.
Definition goto_symex.h:1682
std::vector< renaming::level2t::name_record > va_list_owner_records(const expr2tc &va_list_expr) const
The records va_list_frame looks for: a va_copy destination's are those of the va_list it was copied f...
Definition va_arg.cpp:156
goto_symex_statet * cur_state
Target thread we're currently operating upon.
Definition goto_symex.h:1730
expr2tc guard_identifier()
Return identifier for goto guards.
Definition goto_symex.h:136
void copy_single_element(const expr2tc &old_base_array, const expr2tc &new_array, const expr2tc &idx, const type2tc &elem_type, const type2tc &new_elem_type, bool old_is_array, const guard2tc &guard)
Copy a single element between old and new arrays.
Definition memory_alloc.cpp:188
std::vector< expr2tc > value_set_objects(const expr2tc &ptr, bool &complete)
The objects the value set says ptr may address.
Definition symex_valid_object.cpp:26
expr2tc create_dynamic_memory_symbol(const type2tc &elem_type, const expr2tc &size_expr, const std::string &name_prefix)
Create a new dynamic memory symbol.
Definition memory_alloc.cpp:89
reachability_treet * art1
Reachability tree we're working with.
Definition goto_symex.h:1707
unsigned long total_stack_limit
Limit size, in bits, for every live stack frame taken together.
Definition goto_symex.h:1789
friend class symex_dereference_statet
Definition goto_symex.h:92
virtual void defer_assumption(const expr2tc &assumption)
Hold back the assume that ends a path at a Python assert (#8242).
Definition symex_main.cpp:279
goto_symext::symex_resultt get_symex_result()
Create a symex result for this run.
Definition symex_main.cpp:312
void intrinsic_get_thread_data(const code_function_call2t &call, reachability_treet &art)
Perform get_thread_data; get thread startup information.
Definition threads.cpp:100
void record_guard_definition(const expr2tc &guard_expr, const expr2tc &rhs)
Remember a guard generation's defining condition for path_guard_decides.
Definition symex_goto.cpp:125
void symex_assert()
Interpret an ASSERT instruction.
Definition symex_main.cpp:594
void add_memory_leak_checks()
Perform accounting checks / assertions at end of a program run.
Definition symex_main.cpp:1501
expr2tc rewrite_conjunct(const expr2tc &conjunct)
A path-guard conjunct rewritten onto the canonical basis path_guard_decides compares on.
Definition symex_goto.cpp:202
void symex_assign_array_structure(const expr2tc &lhs, const expr2tc &full_lhs, expr2tc &rhs, expr2tc &full_rhs, guard2tc &guard, const bool hidden)
Perform assignment to an array literal.
Definition symex_assign.cpp:634
void assume_printf_length(const expr2tc &retval, const expr2tc &len)
Assume a printf-family call's return value equals the length of its output, when both are known.
Definition io.cpp:583
contextt & new_context
Context we're working with.
Definition goto_symex.h:1724
void symex_assign_concat(const expr2tc &lhs, const expr2tc &full_lhs, expr2tc &rhs, expr2tc &full_rhs, guard2tc &guard, const bool hidden)
Assign through a 'concat' operation.
Definition symex_assign.cpp:957
void copy_old_objects(const std::list< dereference_callbackt::internal_item > &old_objects, const expr2tc &new_array, const expr2tc &new_elem_count, const type2tc &elem_type, const guard2tc &guard)
Copy each object a reallocated pointer may point to into the new allocation, guarded by the pointer p...
Definition memory_alloc.cpp:324
void symex_other(const expr2tc &code)
Interpret an OTHER instruction.
Definition symex_other.cpp:9
bool handle_realloc_zero_size(const expr2tc &lhs, const sideeffect2t &code, const guard2tc &guard, const expr2tc &realloc_size)
Handle realloc with zero size parameter.
Definition memory_alloc.cpp:280
expr2tc branch_decision_guard(const expr2tc &guard) const
The guard a branch decision is read from.
Definition symex_assign.cpp:257
bool no_reachable_memleak
Flag as to whether we're pruning the objects from the memory leak check that are still reachable via ...
Definition goto_symex.h:1802
bool terminate_handler()
Call terminate function handler when needed.
bool unexpected_handler()
Call unexpected function handler when needed.
const namespacet & ns
Namespace we're working in.
Definition goto_symex.h:1722
virtual void do_simplify(expr2tc &expr)
Perform simplification on an expression.
Definition symex_assign.cpp:251
void run_intrinsic(const code_function_call2t &call, reachability_treet &art, const std::string &symname)
Run an intrinsic, something prefixed with __ESBMC.
Definition symex_main.cpp:643
std::optional< interval_domaint > interval_domain_state
Online interval domain: guard pruning is on by default (disable with –no-interval-symex-guard); asser...
Definition goto_symex.h:1720
irep_idt guard_identifier_s
Symbol prefix for guards.
Definition goto_symex.h:1628
bool get_unwind_recursion(const irep_idt &identifier, BigInt unwind)
Discover whether recursion bound has been exceeded.
Definition symex_function.cpp:144
expr2tc symex_alloca(const expr2tc &lhs, const sideeffect2t &code, const guard2tc &guard)
Symbolic implementation of alloca.
Definition memory_alloc.cpp:81
void symex_bounded_math(const code_function_call2t &call, const std::string &function)
_builtin_bounded<function>(x, exact): the bounded result of a transcendental function,...
Definition bounded_math.cpp:24
void reject_untyped_isinstance(const expr2tc &value)
Definition python_builtins.cpp:115
bool memcpy_symbolic_length(const expr2tc &dst_arg, const expr2tc &src_arg, const expr2tc &n_arg)
Models a memcpy/memmove whose length is not a constant, the case intrinsic_memcpy_impl otherwise defe...
Definition memory_ops.cpp:889
void intrinsic_really_atomic_begin(reachability_treet &art)
Really atomic start/end - atomic blocks that just disable ileaves.
Definition threads.cpp:218
bool memcmp_resolve_operand(const expr2tc &ptr, unsigned long number_of_bytes, expr2tc &object, uint64_t &offset, uint64_t &avail_bytes, bool rename_object=true)
Helper for intrinsic_memcmp: resolve ptr to a single concrete primitive object with a constant offset...
Definition memory_ops.cpp:1207
void key_intrinsic_pointer_reads(const code_function_call2t &call, const irep_idt &id)
Key the reads the memcpy/memmove/memcmp/memchr intrinsics perform, which symex carries out internally...
Definition symex_main.cpp:322
void symex_assign_byte_extract(const expr2tc &lhs, const expr2tc &full_lhs, expr2tc &rhs, expr2tc &full_rhs, guard2tc &guard, const bool hidden)
Perform assignment to a byte extract.
Definition symex_assign.cpp:907
void intrinsic_memcpy(reachability_treet &art, const code_function_call2t &func_call)
Intrinsic call for C memcpy function call.
Definition memory_ops.cpp:1186
void symex_realloc(const expr2tc &lhs, const sideeffect2t &code, const guard2tc &guard)
Implementation of realloc.
Definition memory_alloc.cpp:205
void symex_witness_branching(const expr2tc &old_guard, const expr2tc &new_guard, bool forward, bool &new_guard_true, bool &new_guard_false, const goto_programt::instructiont &instruction)
Definition witness.cpp:102
unsigned int argument_assignments(const irep_idt &function_identifier, const code_type2t &function_type, const std::vector< expr2tc > &arguments)
Join up function arguments.
Definition symex_function.cpp:244
unsigned simplified_claims
Number of assertions that were trivially verified.
Definition goto_symex.h:1699
void symex_return(const expr2tc &code)
Perform interpretation of RETURN instruction.
Definition symex_function.cpp:1179
expr2tc materialise_old_snapshot(const expr2tc &value, const guard2tc &guard)
Give a value storage of its own, for __ESBMC_old.
Definition symex_assign.cpp:370
unsigned first_loop
Loop numbers.
Definition goto_symex.h:1693
void intrinsic_switch_from(reachability_treet &arg)
Yield, always switching away from this thread.
Definition threads.cpp:43
void intrinsic_yield(reachability_treet &arg)
Perform yield; forces a context switch point.
Definition threads.cpp:17
expr2tc named_object(const expr2tc &base) const
base if it is a named object, nil otherwise.
Definition symex_valid_object.cpp:58
expr2tc symex_mem_inf(const expr2tc &lhs, const type2tc &base_type, const guard2tc &guard)
Wrapper around for infinite array allocation.
Definition memory_alloc.cpp:527
void assume_printf_range(const expr2tc &retval, const BigInt &lo, const BigInt &hi, bool may_fail)
Assume a printf-family call's return value lies in [lo, hi], or is -1 when may_fail.
Definition io.cpp:591
expr2tc model_allocation_failure(const expr2tc &result, const expr2tc &old_ptr, const guard2tc &guard, const expr2tc &over_cap, expr2tc &alloc_fail)
Model allocation failure behavior for realloc.
Definition memory_alloc.cpp:434
expr2tc calculate_old_element_count(const expr2tc &old_base_array, const type2tc &elem_type, bool old_is_array)
Calculate the number of elements in the old memory object.
Definition memory_alloc.cpp:389
goto_symext(const namespacet &_ns, contextt &_new_context, const goto_functionst &goto_functions, std::shared_ptr< symex_targett > _target, optionst &opts)
Default constructor.
Definition symex_assign.cpp:32
bool partial_loops
Flag as to whether we're not enabling partial loops.
Definition goto_symex.h:1814
void offer_malloc_zero_null(const expr2tc &size, expr2tc &rhs, guard2tc &alloc_guard)
Offer both outcomes C17 7.22.3p1 permits for a zero-sized malloc, under –malloc-zero-is-null.
Definition memory_alloc.cpp:599
void assume_uf_congruence(const irep_idt &identifier, const irep_idt &name, const std::vector< expr2tc > &arguments, const expr2tc &result, const type2tc &ret_type)
Assume equal arguments imply an equal result against every earlier application of identifier,...
Definition symex_function.cpp:392
bool inductive_step
Flag as to whether we're doing a k-induction inductive step.
Definition goto_symex.h:1826
void symex_function_call(const expr2tc &call)
Perform function call.
Definition symex_function.cpp:376
expr2tc printf_return_length(const expr2tc &lhs, const code_printf2t &call, size_t fmt_idx)
Store an unrenamed sprintf-family call's output and return the length that call returns: the stored l...
Definition io.cpp:553
void claim_nonnull_operand(const expr2tc &ptr, const expr2tc &n, const std::string &func)
Claims ptr is not NULL unless n is zero.
Definition memory_ops.cpp:1276
std::list< allocated_obj > dynamic_memory
List of all allocated objects.
Definition goto_symex.h:1739
expr2tc symex_mem(const bool is_malloc, const expr2tc &lhs, const sideeffect2t &code, const guard2tc &guard)
Wrapper around for alloca and malloc.
Definition memory_alloc.cpp:665
static std::string assertion_message(const namespacet &ns, const goto_programt::instructiont &i)
The message of the claim an ASSERT instruction raises for itself, as opposed to a check symex raises ...
Definition symex_main.cpp:584
bool make_return_assignment(expr2tc &assign, const expr2tc &code_return)
Create assignment for return statement.
Definition symex_function.cpp:1146
std::unordered_map< renaming::level2t::name_record, renaming::level2t::name_record, renaming::level2t::name_rec_hash > va_copied_from
For each va_copy destination, the local va_list whose frame's variadic arguments it reads,...
Definition goto_symex.h:1780
virtual void assertion(const expr2tc &assertion, const std::string &msg)
Perform an assertion.
Definition symex_main.cpp:171
virtual void symex_goto(const expr2tc &old_guard)
Perform GOTO jump using current instruction.
Definition symex_goto.cpp:236
void intrinsic_memcpy_impl(reachability_treet &art, const code_function_call2t &func_call, const std::string &bump_name)
Shared core for intrinsic_memcpy / intrinsic_memmove; bump_name is the C fallback (__memcpy_impl / __...
Definition memory_ops.cpp:949
goto_symext & operator=(const goto_symext &sym)
Definition symex_assign.cpp:194
expr2tc printf_output_length(const code_printf2t &call, size_t fmt_idx, size_t &max_len)
The length of an unrenamed printf-family call's output whose constant format holds only text and d,...
Definition io.cpp:375
void symex_dead(const expr2tc &code)
Interpret an DEAD instruction.
Definition symex_other.cpp:137
void claim_not_code(const expr2tc &guard)
Claim that a memory builtin's operand, on the path guard selects, is not a code object; nothing under...
Definition memory_ops.cpp:819
void replace_nondet(expr2tc &expr)
Replace nondet func calls with nondeterminism.
Definition symex_assign.cpp:1146
void intrinsic_memchr(reachability_treet &art, const code_function_call2t &func_call)
Intrinsic call for C memchr function call.
Definition memory_ops.cpp:1451
void claim_valid_operand(const expr2tc &ptr, const expr2tc &n, const std::string &func)
An INTERNAL dereference drops an unknown or invalid target without a claim, so the memory builtins cl...
Definition memory_ops.cpp:830
expr2tc symex_malloc(const expr2tc &lhs, const sideeffect2t &code, const guard2tc &guard)
Symbolic implementation of malloc.
Definition memory_alloc.cpp:73
friend class bmct
Definition goto_symex.h:93
void phi_function(const statet::merge_statet &merge_state)
Join a previous jump's merge snapshot into the active thread state.
Definition symex_goto.cpp:744
void volatile_check(expr2tc &expr)
Definition misc.cpp:73
expr2tc sprintf_output(const code_printf2t &call, size_t fmt_idx, const type2tc &char_type, std::vector< expr2tc > &chars)
The output of an unrenamed sprintf or snprintf call: its characters before the NUL in chars,...
Definition io.cpp:434
virtual void symex_assign(const expr2tc &code, const bool hidden=false, const guard2tc &guard=guard2tc())
Make symbolic assignment.
Definition symex_assign.cpp:389
bool no_unwinding_assertions
Flag as to whether we're inserting unwinding assertions.
Definition goto_symex.h:1811
void assume_loop_continues(const goto_programt::instructiont &instruction, const expr2tc &guard, bool forward, bool always_jumps)
Narrow the online interval domain by the condition under which a loop GOTO's continuing path proceeds...
Definition symex_goto.cpp:631
virtual void note_bounded_loop_truncation()
Records that a loop was cut off at the unwinding bound with nothing to flag it.
Definition goto_symex.h:522
void va_list_start(const expr2tc &va_list_expr)
va_start: the va_list reads this frame's first variadic argument next.
Definition va_arg.cpp:143
std::optional< renaming::level2t::name_record > va_list_l1_record(const expr2tc &va_list_expr) const
Resolve a va_list expression to the l1 identity record of the local variable backing it; nullopt when...
Definition va_arg.cpp:42
virtual void symex_function_call_code(const expr2tc &call)
Handle a call to a statically-known function: checks recursion bounds, sets up the new frame,...
Definition symex_function.cpp:534
Path-condition guard container.
Definition irep2_guard.h:32
If-then-else expression.
Definition irep2_expr.h:842
inductive_step_disabled_exceptiont(std::string r)
Definition goto_symex.h:29
std::string reason
Definition goto_symex.h:33
Definition namespace.h:10
Persistent (structurally shared) map with O(1) copy.
Definition persistent_map.h:31
Class to explore states reachable through threading.
Definition reachability_tree.h:65
Definition renaming.h:147
Irep for various side effects.
Definition irep2_expr.h:1906
void dump_internal_state(const std::list< struct internal_item > &data) override
Definition symex_dereference.cpp:148
void get_value_set(const expr2tc &expr, value_setst::valuest &value_set) override
Fetch the set of values that the given pointer variable can point at.
Definition symex_dereference.cpp:57
symex_dereference_statet(goto_symext &_goto_symex, goto_symext::statet &_state)
Definition goto_symex.h:1850
goto_symext::statet & state
Definition goto_symex.h:1859
void dereference_assume(const guard2tc &guard) override
Definition symex_dereference.cpp:19
void dereference_failure(const std::string &property, const std::string &msg, const guard2tc &guard) override
Encode a dereference failure assertion.
Definition symex_dereference.cpp:8
bool has_failed_symbol(const expr2tc &expr, const symbolt *&symbol) override
Check whether a failed symbol already exists for the given symbol.
Definition symex_dereference.cpp:27
bool is_live_variable(const expr2tc &sym) override
Determine whether variable is "alive".
Definition symex_dereference.cpp:155
void rename(expr2tc &expr) override
Rename the given expression into the callback's current execution context.
Definition symex_dereference.cpp:143
goto_symext & goto_symex
Definition goto_symex.h:1858
tv_enumt
Definition threeval.h:13
std::list< expr2tc > valuest
Definition value_sets.h:15
The dereferencing code's purpose is to take a symbol with pointer type that is being dereferenced,...
Classes and definitions for non-stringy internal representation.
irep_container< type2t > type2tc
Definition irep2.h:430
irep_container< expr2t > expr2tc
Definition irep2.h:431
@ level1
Definition irep2_expr.h:56
const std::string & id2string(const irep_idt &d)
Definition irep.h:1405
Definition goto_symex.h:1881
expr2tc gen_byte_memcpy(const expr2tc &src, const expr2tc &dst, const size_t num_of_bytes, const size_t src_offset, const size_t dst_offset)
Computes the equivalent object value when considering a memcpy operation on it.
Definition memory_ops.cpp:435
bool is_alloca_return_value_name(const std::string &name)
Returns true iff name is the goto-program return-value temp for an alloca / __builtin_alloca call,...
Definition symex_function.cpp:19
Definition exception.cpp:51
property_verdictt
Outcome of checking one property.
Definition property_verdict.h:25
#define bool
Definition stdbool.h:9
The different ways in which a pointer may be accessed.
Definition dereference.h:202
Definition goto_symex.h:1675
unsigned loop_number
Definition goto_symex.h:1679
symex_targett::sourcet source
Definition goto_symex.h:1678
expr2tc cond
Definition goto_symex.h:1677
expr2tc guard
Definition goto_symex.h:1676
Definition renaming.h:230
Definition symex_target.h:31