ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
goto_symex.h
Go to the documentation of this file.
1#ifndef CPROVER_GOTO_SYMEX_GOTO_SYMEX_H
2#define CPROVER_GOTO_SYMEX_GOTO_SYMEX_H
3
9#include <functional>
10#include <map>
11#include <optional>
13#include <util/base/i2string.h>
14#include <irep2/irep2.h>
15#include <util/config/options.h>
16#include <util/irep/std_types.h>
17
18class reachability_treet; // Forward dec
19class execution_statet; // Forward dec
21
22// Thrown by symex when the inductive step encounters a construct it cannot
23// soundly encode (recursion, threads, function-pointer calls). The thrower
24// also sets `disable-inductive-step` so the strategy layer downgrades the
25// result to UNKNOWN; the throw short-circuits the rest of symex.
27{
28public:
29 explicit inductive_step_disabled_exceptiont(std::string r)
30 : reason(std::move(r))
31 {
32 }
33 std::string reason;
34};
35
45
47{
48public:
58 const namespacet &_ns,
59 contextt &_new_context,
61 std::shared_ptr<symex_targett> _target,
62 optionst &opts);
63 goto_symext(const goto_symext &sym);
65
66 // Types
67
68public:
71 {
72 public:
74 const expr2tc &s,
75 const guard2tc &g,
76 const bool a,
77 const std::string n)
78 : obj(s), alloc_guard(g), auto_deallocd(a), name(n)
79 {
80 }
81
89 std::string name;
90 };
91
93 friend class bmct;
94 friend class reachability_treet;
95
97
106 {
107 public:
109 std::shared_ptr<symex_targett> t,
110 unsigned int claims,
111 unsigned int remain,
112 unsigned int simplified,
113 unsigned int truncations = 0)
114 : target(std::move(t)),
115 total_claims(claims),
116 remaining_claims(remain),
117 simplified_claims(simplified),
118 bounded_loop_truncations(truncations) {};
119 std::shared_ptr<symex_targett> target;
120 unsigned int total_claims;
121 unsigned int remaining_claims;
122 unsigned int simplified_claims;
127 };
128
137 {
138 return symbol2tc(
142 0,
143 0,
144 cur_state->top().level1.thread_id,
145 0);
146 };
147
148 // Methods
149
160 bool chase_copies(expr2tc &expr) const;
161
169 const expr2tc &new_guard,
170 bool already_false,
171 bool already_true);
172
177 void record_guard_definition(const expr2tc &guard_expr, const expr2tc &rhs);
178
183 expr2tc rewrite_conjunct(const expr2tc &conjunct);
184
187
193
204 void record_copy_definition(const expr2tc &renamed_lhs, const expr2tc &rhs);
205
210
220 virtual void symex_step(reachability_treet &art);
221
228
229protected:
236 virtual void do_simplify(expr2tc &expr);
237
246 expr2tc branch_decision_guard(const expr2tc &guard) const;
247
259 void dereference(
260 expr2tc &expr,
262 bool block_assertions = false);
263
264 // symex
265
275 virtual void symex_goto(const expr2tc &old_guard);
276
285 virtual void record_parked_path(
287 statet::merge_state_listt::iterator /*parked*/)
288 {
289 }
290
295 void symex_return(const expr2tc &code);
296 void
297 symex_witness_function_return(expr2tc ret_val, const irep_idt &call_line);
298 bool symex_witness_function_enter(const irep_idt &call_line);
300 const expr2tc &old_guard,
301 const expr2tc &new_guard,
302 bool forward,
303 bool &new_guard_true,
304 bool &new_guard_false,
305 const goto_programt::instructiont &instruction);
306 void symex_witness_assert(expr2tc &new_expr, const std::string &msg);
307
314 void symex_other(const expr2tc &code);
315
324 void symex_decl(const expr2tc &code);
325
331 void symex_dead(const expr2tc &code);
332
336 {
337 return stack_limit > 0 || total_stack_limit > 0;
338 }
339
346 void check_stack_size(const expr2tc &expr, const std::string &subject = "");
347
351 void symex_assume();
352
356 void symex_assert();
357
358public:
361 static std::string
363
368 {
369 guard_prefix_index.clear();
370 }
371
372protected:
381 bool check_incremental(const expr2tc &expr, const std::string &msg);
382
390 virtual void claim(const expr2tc &expr, const std::string &msg);
391
402 const std::string &msg,
403 property_verdictt verdict,
404 const std::string &note = "");
405
412 virtual void assertion(const expr2tc &assertion, const std::string &msg);
413
429 void propagate_assume_equality(const expr2tc &the_assumption);
430
436 virtual void assume(const expr2tc &assumption);
437
446 virtual void defer_assumption(const expr2tc &assumption);
447
451
452 // gotos
460 void merge_gotos();
461
468 void merge_value_sets(const statet::merge_statet &merge_state);
469
470 void merge_locality(const statet::merge_statet &merge_state);
471
474 void snapshot_interval_domain(statet::merge_statet &merge_state);
475
480 const goto_programt::instructiont &instruction,
481 const expr2tc &guard,
482 bool forward,
483 bool always_jumps);
484
487 void merge_interval_domain(const statet::merge_statet &merge_state);
488
497 void phi_function(const statet::merge_statet &merge_state);
498
508 bool get_unwind(const symex_targett::sourcet &source, const BigInt &unwind);
509
517 void loop_bound_exceeded(const expr2tc &guard);
518
526
527 // function calls
528
534 void pop_frame();
535
546 bool is_python_gc_object(const symbolt *base) const;
547
555 bool make_return_assignment(expr2tc &assign, const expr2tc &code_return);
556
563 void symex_function_call(const expr2tc &call);
564
572
582 virtual void symex_function_call_deref(const expr2tc &call);
583
590 virtual void symex_function_call_code(const expr2tc &call);
591
605 const code_function_call2t &call,
606 const irep_idt &identifier);
607
615 bool get_unwind_recursion(const irep_idt &identifier, BigInt unwind);
616
620 const type2tc &arg_type,
621 const expr2tc &rhs,
622 const irep_idt &identifier);
623
632 unsigned int argument_assignments(
633 const irep_idt &function_identifier,
634 const code_type2t &function_type,
635 const std::vector<expr2tc> &arguments);
636
643 bool run_next_function_ptr_target(bool first);
644
654 void run_intrinsic(
655 const code_function_call2t &call,
657 const std::string &symname);
658
667 bool
668 run_builtin(const code_function_call2t &call, const std::string &symname);
669
673 const code_function_call2t &call,
674 const std::string &function);
675
679 void
685 const code_function_call2t &call,
686 reachability_treet &art);
689 const code_function_call2t &call,
690 reachability_treet &art);
693 const code_function_call2t &call,
694 reachability_treet &art);
697 const code_function_call2t &call,
698 reachability_treet &art);
718 const code_function_call2t &call,
719 reachability_treet &art);
731 void intrinsic_memset(
733 const code_function_call2t &func_call);
734
744 void intrinsic_memcpy(
746 const code_function_call2t &func_call);
747
759 void intrinsic_memchr(
761 const code_function_call2t &func_call);
762
768 void intrinsic_memcmp(
770 const code_function_call2t &func_call);
771
780 const expr2tc &dst_arg,
781 const expr2tc &src_arg,
782 const expr2tc &n_arg);
783
786 void memcpy_finish(
787 const code_function_call2t &func_call,
788 const expr2tc &dst_arg,
789 const expr2tc &src_arg,
790 const expr2tc &n_arg);
791
796 const expr2tc &ptr,
797 const expr2tc &n,
798 const std::string &func);
799
802 void claim_not_code(const expr2tc &guard);
803
809 const expr2tc &ptr,
810 unsigned long number_of_bytes,
811 expr2tc &object,
812 uint64_t &offset,
813 uint64_t &avail_bytes,
814 bool rename_object = true);
815
818 const expr2tc &ptr,
819 const expr2tc &n,
820 const std::string &func);
821
827 const code_function_call2t &func_call);
828
834 const code_function_call2t &func_call,
835 const std::string &bump_name);
836
837 // Function to call a symname function, in case where were not able to
838 // optimize it
839 void
840 bump_call(const code_function_call2t &func_call, const std::string &symname);
841
847 const code_function_call2t &func_call,
848 reachability_treet &art);
849
869 const code_function_call2t &func_call,
870 reachability_treet &art);
871
872 /* Handles dereferencing between threads and is used only in data race checks.
873 * **/
874 void replace_races_check(expr2tc &expr);
875
878
879 void volatile_check(expr2tc &expr);
880
895 const expr2tc &lhs,
896 const expr2tc &result,
897 const expr2tc &new_array,
898 const guard2tc &guard,
899 const expr2tc &realloc_size,
900 const expr2tc &alloc_fail);
901
911 const expr2tc &old_ptr,
912 const expr2tc &alloc_fail,
913 const guard2tc &guard);
914
928 const expr2tc &result,
929 const expr2tc &old_ptr,
930 const guard2tc &guard,
931 const expr2tc &over_cap,
932 expr2tc &alloc_fail);
933
943
952 expr2tc
953 create_result_pointer(const expr2tc &new_array, const type2tc &lhs_type);
954
965 const expr2tc &old_base_array,
966 const type2tc &elem_type,
967 bool old_is_array);
968
977 expr2tc
978 calculate_element_count(const expr2tc &size_bytes, const expr2tc &elem_size);
979
988 type2tc
990
999 const expr2tc &old_obj,
1000 type2tc &elem_type,
1001 expr2tc &old_base_array,
1002 bool &old_is_array);
1003
1013 void copy_old_objects(
1014 const std::list<dereference_callbackt::internal_item> &old_objects,
1015 const expr2tc &new_array,
1016 const expr2tc &new_elem_count,
1017 const type2tc &elem_type,
1018 const guard2tc &guard);
1019
1032 const expr2tc &lhs,
1033 const sideeffect2t &code,
1034 const guard2tc &guard,
1035 const expr2tc &realloc_size);
1036
1050 const expr2tc &old_base_array,
1051 const expr2tc &new_array,
1052 const expr2tc &idx,
1053 const type2tc &elem_type,
1054 const type2tc &new_elem_type,
1055 bool old_is_array,
1056 const guard2tc &guard);
1057
1072 const expr2tc &old_base_array,
1073 const expr2tc &new_array,
1074 const expr2tc &old_elem_count,
1075 const expr2tc &new_elem_count,
1076 const type2tc &elem_type,
1077 bool old_is_array,
1078 const guard2tc &guard);
1079
1091 const type2tc &elem_type,
1092 const expr2tc &size_expr,
1093 const std::string &name_prefix);
1094
1099
1104
1115
1116 std::vector<expr2tc> value_set_objects(const expr2tc &ptr, bool &complete);
1117 expr2tc named_object(const expr2tc &base) const;
1119 expr2tc &expr,
1120 const expr2tc &ptr,
1121 const std::function<expr2tc(const expr2tc &)> &resolve);
1122 bool resolve_valid_object_by_value_set(expr2tc &expr, const expr2tc &obj_ref);
1124 void replace_valid_object(expr2tc &expr);
1125 void replace_dynamic_size(expr2tc &expr);
1127
1133 bool is_valid_object(const symbolt &symbol);
1134
1145 void handle_sideeffect(
1146 const expr2tc &lhs,
1147 const sideeffect2t &effect,
1148 const guard2tc &guard);
1149
1159 bool handle_conditional(
1160 const expr2tc &lhs,
1161 const if2t &if_effect,
1162 const guard2tc &guard);
1163
1176 virtual void symex_assign(
1177 const expr2tc &code,
1178 const bool hidden = false,
1179 const guard2tc &guard = guard2tc());
1180
1189
1191 void symex_assign_rec(
1192 const expr2tc &lhs,
1193 const expr2tc &full_lhs,
1194 expr2tc &rhs,
1195 expr2tc full_rhs,
1196 guard2tc &guard,
1197 const bool hidden);
1198
1209 const expr2tc &lhs,
1210 const expr2tc &full_lhs,
1211 expr2tc &rhs,
1212 expr2tc &full_rhs,
1213 guard2tc &guard,
1214 const bool hidden);
1215
1235 const expr2tc &lhs,
1236 const expr2tc &full_lhs,
1237 expr2tc &rhs,
1238 expr2tc &full_rhs,
1239 guard2tc &guard,
1240 const bool hidden);
1241
1256 const expr2tc &lhs,
1257 const expr2tc &full_lhs,
1258 expr2tc &rhs,
1259 expr2tc &full_rhs,
1260 guard2tc &guard,
1261 const bool hidden);
1262
1271 void symex_assign_union(
1272 const expr2tc &lhs,
1273 const expr2tc &full_lhs,
1274 expr2tc &rhs,
1275 expr2tc &full_rhs,
1276 guard2tc &guard,
1277 const bool hidden);
1278
1293 const expr2tc &lhs,
1294 const expr2tc &full_lhs,
1295 expr2tc &rhs,
1296 expr2tc &full_rhs,
1297 guard2tc &guard,
1298 const bool hidden);
1299
1309 const expr2tc &lhs,
1310 const expr2tc &full_lhs,
1311 expr2tc &rhs,
1312 expr2tc &full_rhs,
1313 guard2tc &guard,
1314 const bool hidden);
1315
1326 void symex_assign_array(
1327 const expr2tc &lhs,
1328 const expr2tc &full_lhs,
1329 expr2tc &rhs,
1330 expr2tc &full_rhs,
1331 guard2tc &guard,
1332 const bool hidden);
1333
1344 const expr2tc &lhs,
1345 const expr2tc &full_lhs,
1346 expr2tc &rhs,
1347 expr2tc &full_rhs,
1348 guard2tc &guard,
1349 const bool hidden);
1350
1360 void symex_assign_if(
1361 const expr2tc &lhs,
1362 const expr2tc &full_lhs,
1363 expr2tc &rhs,
1364 expr2tc &full_rhs,
1365 guard2tc &guard,
1366 const bool hidden);
1367
1379 const expr2tc &lhs,
1380 const expr2tc &full_lhs,
1381 expr2tc &rhs,
1382 expr2tc &full_rhs,
1383 guard2tc &guard,
1384 const bool hidden);
1385
1398 const expr2tc &lhs,
1399 const expr2tc &full_lhs,
1400 expr2tc &rhs,
1401 expr2tc &full_rhs,
1402 guard2tc &guard,
1403 const bool hidden);
1404
1416 const expr2tc &lhs,
1417 const expr2tc &full_lhs,
1418 expr2tc &rhs,
1419 expr2tc &full_rhs,
1420 guard2tc &guard,
1421 const bool hidden);
1422
1425 const expr2tc &lhs,
1426 const sideeffect2t &code,
1427 const guard2tc &guard);
1429 void symex_realloc(
1430 const expr2tc &lhs,
1431 const sideeffect2t &code,
1432 const guard2tc &guard);
1435 const expr2tc &lhs,
1436 const sideeffect2t &code,
1437 const guard2tc &guard);
1440 const bool is_malloc,
1441 const expr2tc &lhs,
1442 const sideeffect2t &code,
1443 const guard2tc &guard);
1447 const expr2tc &size,
1448 expr2tc &rhs,
1449 guard2tc &alloc_guard);
1452 const expr2tc &lhs,
1453 const type2tc &base_type,
1454 const guard2tc &guard);
1455
1457 void track_new_pointer(
1458 const expr2tc &ptr_obj,
1459 const type2tc &new_type,
1460 const guard2tc &guard,
1461 const expr2tc &size = expr2tc());
1464 const expr2tc &lhs,
1465 const expr2tc &object,
1466 bool is_malloc);
1468 void symex_free(const expr2tc &expr);
1470 void invalidate_object(const expr2tc &ptr);
1472 void symex_cpp_delete(const expr2tc &code);
1474 void symex_cpp_new(
1475 const expr2tc &lhs,
1476 const sideeffect2t &code,
1477 const guard2tc &guard);
1479 virtual void symex_printf(const expr2tc &lhs, expr2tc &code);
1487 const code_printf2t &call,
1488 size_t fmt_idx,
1489 const type2tc &char_type,
1490 std::vector<expr2tc> &chars);
1496 const code_printf2t &call,
1497 size_t fmt_idx,
1498 size_t &max_len);
1502 expr2tc string_length(const expr2tc &ptr, size_t &max_len);
1507 const expr2tc &lhs,
1508 const code_printf2t &call,
1509 size_t fmt_idx);
1512 void assume_printf_length(const expr2tc &retval, const expr2tc &len);
1516 const expr2tc &retval,
1517 const BigInt &lo,
1518 const BigInt &hi,
1519 bool may_fail);
1523 void symex_asprintf_buffer(const expr2tc &strp, const expr2tc &retval);
1528 const code_printf2t &call,
1529 size_t fmt_idx,
1531 bool &constant_args);
1545 const code_printf2t &call,
1546 size_t fmt_idx,
1547 std::list<expr2tc> &out);
1549 void symex_input(const code_function_call2t &expr);
1551 void symex_va_arg(
1552 const expr2tc &lhs,
1553 const sideeffect2t &code,
1554 const guard2tc &guard);
1557 std::optional<renaming::level2t::name_record>
1558 va_list_l1_record(const expr2tc &va_list_expr) const;
1561 std::vector<renaming::level2t::name_record>
1562 va_list_pointee_records(const expr2tc &va_list_expr) const;
1567 bool va_list_is_started(const expr2tc &va_list_expr) const;
1572 const expr2tc &va_list_expr,
1573 bool started,
1574 const expr2tc &cursor);
1576 void va_list_start(const expr2tc &va_list_expr);
1583 expr2tc va_list_cursor(const expr2tc &va_list_expr);
1586 std::vector<renaming::level2t::name_record>
1587 va_list_owner_records(const expr2tc &va_list_expr) const;
1589 void va_list_copy(const expr2tc &dst, const expr2tc &src);
1593 goto_symex_statet::framet &va_list_frame(const expr2tc &va_list_expr);
1594
1601 void replace_nondet(expr2tc &expr);
1602
1607 virtual unsigned int &get_dynamic_counter() = 0;
1612 virtual unsigned int &get_nondet_counter() = 0;
1616 bool is_assume_false(const expr2tc &assumption);
1617
1618 // Members
1619
1634 static constexpr size_t max_copy_definition_nodes = 64;
1673
1681
1682 std::vector<deferred_assumptiont> deferred_assumptions;
1686
1690 std::unordered_map<irep_idt, expr2tc> dynamic_object_sizes;
1691
1693 unsigned first_loop;
1709 std::map<unsigned, BigInt> unwind_set;
1712 std::map<std::pair<std::string, unsigned>, BigInt> unwind_func_set;
1714 std::map<unsigned, std::pair<std::string, unsigned>> loop_id_to_func_index;
1720 std::optional<interval_domaint> interval_domain_state;
1728 std::shared_ptr<symex_targett> target;
1739 std::list<allocated_obj> dynamic_memory;
1740
1746 std::map<irep_idt, std::vector<std::pair<std::vector<expr2tc>, expr2tc>>>
1748
1753 const irep_idt &identifier,
1754 const irep_idt &name,
1755 const std::vector<expr2tc> &arguments,
1756 const expr2tc &result,
1757 const type2tc &ret_type);
1758
1769 std::unordered_map<
1771 bool,
1776 std::unordered_map<
1781
1785 unsigned long stack_limit;
1789 unsigned long total_stack_limit;
1791 unsigned long depth_limit;
1795 unsigned long break_insn;
1830
1834 std::list<dereference_callbackt::internal_item> internal_deref_items;
1838 virtual void analyze_args(const expr2tc &expr) = 0;
1842 const code_function_call2t &call,
1843 const irep_idt &id);
1845};
1846
1848{
1849public:
1851 goto_symext &_goto_symex,
1852 goto_symext::statet &_state)
1853 : goto_symex(_goto_symex), state(_state)
1854 {
1855 }
1856
1857protected:
1860
1862 const std::string &property,
1863 const std::string &msg,
1864 const guard2tc &guard) override;
1865
1866 void dereference_assume(const guard2tc &guard) override;
1867
1868 void
1869 get_value_set(const expr2tc &expr, value_setst::valuest &value_set) override;
1870
1871 bool has_failed_symbol(const expr2tc &expr, const symbolt *&symbol) override;
1872
1873 void rename(expr2tc &expr) override;
1874
1875 void
1876 dump_internal_state(const std::list<struct internal_item> &data) override;
1877 bool is_live_variable(const expr2tc &sym) override;
1878};
1879
1881{
1909 const expr2tc &src,
1910 const expr2tc &dst,
1911 const size_t num_of_bytes,
1912 const size_t src_offset,
1913 const size_t dst_offset);
1914
1926bool is_alloca_return_value_name(const std::string &name);
1927} // namespace goto_symex_utils
1928
1929#endif
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 bigint.hh:58
Definition irep2_expr.h:2007
Definition irep2_expr.h:2175
Definition irep2_expr.h:2034
Type of functions.
Definition irep2_type.h:333
Definition context.h:57
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 toml.hpp:10247
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 &note="")
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 irep_idt.h:12
Definition namespace.h:10
Definition options.h:11
Persistent (structurally shared) map with O(1) copy.
Definition persistent_map.h:31
Definition printf_formatter.h:12
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
Definition symbol.h:12
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
Definition toml.hpp:1531
The dereferencing code's purpose is to take a symbol with pointer type that is being dereferenced,...
Interval Domain.
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
@ identifier
Definition nested_func_transform.cpp:62
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 module.h:12
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