cprover
symex_function_call.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Symbolic Execution of ANSI-C
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
11 
12 #include "goto_symex.h"
13 
14 #include <analyses/guard_expr.h>
15 #include <util/arith_tools.h>
16 #include <util/byte_operators.h>
17 #include <util/c_types.h>
18 #include <util/exception_utils.h>
19 #include <util/fresh_symbol.h>
20 #include <util/invariant.h>
21 #include <util/prefix.h>
22 #include <util/range.h>
23 
24 #include "expr_skeleton.h"
25 #include "symex_assign.h"
26 
27 static void locality(
28  const irep_idt &function_identifier,
29  goto_symext::statet &state,
30  path_storaget &path_storage,
31  const goto_functionst::goto_functiont &goto_function,
32  const namespacet &ns);
33 
34 bool goto_symext::get_unwind_recursion(const irep_idt &, unsigned, unsigned)
35 {
36  return false;
37 }
38 
40  const irep_idt &function_identifier,
41  const goto_functionst::goto_functiont &goto_function,
42  statet &state,
43  const exprt::operandst &arguments)
44 {
45  const code_typet &function_type=goto_function.type;
46 
47  // iterates over the arguments
48  exprt::operandst::const_iterator it1=arguments.begin();
49 
50  // iterates over the types of the parameters
51  for(const auto &identifier : goto_function.parameter_identifiers)
52  {
53  INVARIANT(
54  !identifier.empty(), "function parameter must have an identifier");
55  state.call_stack().top().parameter_names.push_back(identifier);
56 
57  const symbolt &symbol=ns.lookup(identifier);
58  symbol_exprt lhs=symbol.symbol_expr();
59 
60  // this is the type that the n-th argument should have
61  const typet &parameter_type = symbol.type;
62 
63  exprt rhs;
64 
65  // if you run out of actual arguments there was a mismatch
66  if(it1==arguments.end())
67  {
68  log.warning() << state.source.pc->source_location.as_string()
69  << ": "
70  "call to '"
71  << id2string(function_identifier)
72  << "': "
73  "not enough arguments, inserting non-deterministic value"
74  << log.eom;
75 
77  parameter_type, state.source.pc->source_location);
78  }
79  else
80  rhs=*it1;
81 
82  if(rhs.is_nil())
83  {
84  // 'nil' argument doesn't get assigned
85  }
86  else
87  {
88  // It should be the same exact type.
89  if(parameter_type != rhs.type())
90  {
91  const typet &rhs_type = rhs.type();
92 
93  // But we are willing to do some limited conversion.
94  // This is highly dubious, obviously.
95  // clang-format off
96  if(
97  (parameter_type.id() == ID_signedbv ||
98  parameter_type.id() == ID_unsignedbv ||
99  parameter_type.id() == ID_c_enum_tag ||
100  parameter_type.id() == ID_bool ||
101  parameter_type.id() == ID_pointer ||
102  parameter_type.id() == ID_union ||
103  parameter_type.id() == ID_union_tag) &&
104  (rhs_type.id() == ID_signedbv ||
105  rhs_type.id() == ID_unsignedbv ||
106  rhs_type.id() == ID_c_bit_field ||
107  rhs_type.id() == ID_c_enum_tag ||
108  rhs_type.id() == ID_bool ||
109  rhs_type.id() == ID_pointer ||
110  rhs_type.id() == ID_union ||
111  rhs_type.id() == ID_union_tag))
112  {
113  rhs=
115  byte_extract_id(),
116  rhs,
117  from_integer(0, index_type()),
118  parameter_type);
119  }
120  // clang-format on
121  else
122  {
123  std::ostringstream error;
124  error << state.source.pc->source_location.as_string() << ": "
125  << "function call: parameter \"" << identifier
126  << "\" type mismatch:\ngot " << rhs.type().pretty()
127  << "\nexpected " << parameter_type.pretty();
128  throw unsupported_operation_exceptiont(error.str());
129  }
130  }
131 
132  assignment_typet assignment_type;
133 
134  // We hide if we are in a hidden function.
135  if(state.call_stack().top().hidden_function)
136  assignment_type =
138  else
139  assignment_type =
141 
142  lhs = to_symbol_expr(clean_expr(std::move(lhs), state, true));
143  rhs = clean_expr(std::move(rhs), state, false);
144 
145  exprt::operandst lhs_conditions;
146  symex_assignt{state, assignment_type, ns, symex_config, target}
147  .assign_rec(lhs, expr_skeletont{}, rhs, lhs_conditions);
148  }
149 
150  if(it1!=arguments.end())
151  it1++;
152  }
153 
154  if(function_type.has_ellipsis())
155  {
156  // These are va_arg arguments; their types may differ from call to call
157  for(; it1 != arguments.end(); it1++)
158  {
159  symbolt &va_arg = get_fresh_aux_symbol(
160  it1->type(),
161  id2string(function_identifier),
162  "va_arg",
163  state.source.pc->source_location,
164  ns.lookup(function_identifier).mode,
165  state.symbol_table);
166  va_arg.is_parameter = true;
167 
168  state.call_stack().top().parameter_names.push_back(va_arg.name);
169 
170  symex_assign(state, code_assignt{va_arg.symbol_expr(), *it1});
171  }
172  }
173  else if(it1!=arguments.end())
174  {
175  // we got too many arguments, but we will just ignore them
176  }
177 }
178 
180  const get_goto_functiont &get_goto_function,
181  statet &state,
182  const code_function_callt &code)
183 {
184  const exprt &function=code.function();
185 
186  // If at some point symex_function_call can support more
187  // expression ids(), like ID_Dereference, please expand the
188  // precondition appropriately.
189  PRECONDITION(function.id() == ID_symbol);
191 }
192 
194  const get_goto_functiont &get_goto_function,
195  statet &state,
196  const code_function_callt &original_code)
197 {
198  code_function_callt code = original_code;
199 
200  if(code.lhs().is_not_nil())
201  code.lhs() = clean_expr(std::move(code.lhs()), state, true);
202 
203  code.function() = clean_expr(std::move(code.function()), state, false);
204 
205  Forall_expr(it, code.arguments())
206  *it = clean_expr(std::move(*it), state, false);
207 
208  target.location(state.guard.as_expr(), state.source);
209 
210  PRECONDITION(code.function().id() == ID_symbol);
211 
212  const irep_idt &identifier=
214 
215  if(has_prefix(id2string(identifier), CPROVER_FKT_PREFIX))
216  {
217  symex_fkt(state, code);
218  }
219  else
221 }
222 
224  const get_goto_functiont &get_goto_function,
225  statet &state,
226  const code_function_callt &call)
227 {
228  const irep_idt &identifier=
230 
231  const goto_functionst::goto_functiont &goto_function =
232  get_goto_function(identifier);
233 
234  path_storage.dirty.populate_dirty_for_function(identifier, goto_function);
235 
236  auto emplace_safe_pointers_result =
237  path_storage.safe_pointers.emplace(identifier, local_safe_pointerst{});
238  if(emplace_safe_pointers_result.second)
239  emplace_safe_pointers_result.first->second(goto_function.body);
240 
241  const bool stop_recursing = get_unwind_recursion(
242  identifier,
243  state.source.thread_nr,
244  state.call_stack().top().loop_iterations[identifier].count);
245 
246  // see if it's too much
247  if(stop_recursing)
248  {
250  {
251  // it's ok, ignore
252  }
253  else
254  {
256  vcc(false_exprt(), "recursion unwinding assertion", state);
257 
258  // Rule out this path:
259  symex_assume_l2(state, false_exprt());
260  }
261 
262  symex_transition(state);
263  return;
264  }
265 
266  // read the arguments -- before the locality renaming
267  const exprt::operandst &arguments = call.arguments();
268  const std::vector<renamedt<exprt, L2>> renamed_arguments =
269  make_range(arguments).map(
270  [&](const exprt &a) { return state.rename(a, ns); });
271 
272  // we hide the call if the caller and callee are both hidden
273  const bool callee_is_hidden = ns.lookup(identifier).is_hidden();
274  const bool hidden =
275  state.call_stack().top().hidden_function && callee_is_hidden;
276 
277  // record the call
279  state.guard.as_expr(), identifier, renamed_arguments, state.source, hidden);
280 
281  if(!goto_function.body_available())
282  {
283  no_body(identifier);
284 
285  // record the return
287  state.guard.as_expr(), identifier, state.source, hidden);
288 
289  if(call.lhs().is_not_nil())
290  {
291  const auto rhs =
293  code_assignt code(call.lhs(), rhs);
294  symex_assign(state, code);
295  }
296 
298  {
299  // assign non det to function arguments if pointers
300  // are not const
301  for(const auto &arg : call.arguments())
302  {
303  if(
304  arg.type().id() == ID_pointer &&
305  !arg.type().subtype().get_bool(ID_C_constant) &&
306  arg.type().subtype().id() != ID_code)
307  {
308  exprt object = dereference_exprt(arg, arg.type().subtype());
309  exprt cleaned_object = clean_expr(object, state, true);
310  const guardt guard(true_exprt(), state.guard_manager);
311  havoc_rec(state, guard, cleaned_object);
312  }
313  }
314  }
315 
316  symex_transition(state);
317  return;
318  }
319 
320  // produce a new frame
321  PRECONDITION(!state.call_stack().empty());
322  framet &frame = state.call_stack().new_frame(state.source, state.guard);
323 
324  // Only enable loop analysis when complexity is enabled.
326  {
327  // Analyzes loops if required.
328  path_storage.add_function_loops(identifier, goto_function.body);
329  frame.loops_info = path_storage.get_loop_analysis(identifier);
330  }
331 
332  // preserve locality of local variables
333  locality(identifier, state, path_storage, goto_function, ns);
334 
335  // assign actuals to formal parameters
336  parameter_assignments(identifier, goto_function, state, arguments);
337 
338  frame.end_of_function=--goto_function.body.instructions.end();
339  frame.return_value=call.lhs();
340  frame.function_identifier=identifier;
341  frame.hidden_function = callee_is_hidden;
342 
343  const framet &p_frame = state.call_stack().previous_frame();
344  for(const auto &pair : p_frame.loop_iterations)
345  {
346  if(pair.second.is_recursion)
347  frame.loop_iterations.insert(pair);
348  }
349 
350  // increase unwinding counter
351  frame.loop_iterations[identifier].is_recursion=true;
352  frame.loop_iterations[identifier].count++;
353 
354  state.source.function_id = identifier;
355  symex_transition(state, goto_function.body.instructions.begin(), false);
356 }
357 
359 static void pop_frame(
360  goto_symext::statet &state,
361  const path_storaget &path_storage,
362  bool doing_path_exploration)
363 {
364  PRECONDITION(!state.call_stack().empty());
365 
366  {
367  const framet &frame = state.call_stack().top();
368 
369  // restore program counter
370  symex_transition(state, frame.calling_location.pc, false);
372 
373  // restore L1 renaming
374  state.level1.restore_from(frame.old_level1);
375 
376  // If the program is multi-threaded then the state guard is used to
377  // accumulate assumptions (in symex_assume_l2) and must be left alone.
378  // If however it is single-threaded then we should restore the guard, as the
379  // guard coming out of the function may be more complex (e.g. if the callee
380  // was { if(x) while(true) { } } then the guard may still be `!x`),
381  // but at this point all control-flow paths have either converged or been
382  // proven unviable, so we can stop specifying the callee's constraints when
383  // we generate an assumption or VCC.
384 
385  // If we're doing path exploration then we do tail-duplication, and we
386  // actually *are* in a more-restricted context than we were when the
387  // function began.
388  if(state.threads.size() == 1 && !doing_path_exploration)
389  {
390  state.guard = frame.guard_at_function_start;
391  }
392 
394  state.get_level2().current_names.get_view(view);
395 
396  std::vector<irep_idt> keys_to_erase;
397 
398  for(const auto &pair : view)
399  {
400  const irep_idt l1_o_id = pair.second.first.get_l1_object_identifier();
401 
402  // could use iteration over local_objects as l1_o_id is prefix
403  if(
404  frame.local_objects.find(l1_o_id) == frame.local_objects.end() ||
405  (state.threads.size() > 1 &&
406  path_storage.dirty(pair.second.first.get_object_name())))
407  {
408  continue;
409  }
410 
411  keys_to_erase.push_back(pair.first);
412  }
413 
414  for(const irep_idt &key : keys_to_erase)
415  {
416  state.drop_existing_l1_name(key);
417  }
418  }
419 
420  state.call_stack().pop();
421 }
422 
425 {
426  const bool hidden = state.call_stack().top().hidden_function;
427 
428  // first record the return
430  state.guard.as_expr(), state.source.function_id, state.source, hidden);
431 
432  // then get rid of the frame
434 }
435 
438 static void locality(
439  const irep_idt &function_identifier,
440  goto_symext::statet &state,
441  path_storaget &path_storage,
442  const goto_functionst::goto_functiont &goto_function,
443  const namespacet &ns)
444 {
445  unsigned &frame_nr=
446  state.threads[state.source.thread_nr].function_frame[function_identifier];
447  frame_nr++;
448 
449  for(const auto &param : goto_function.parameter_identifiers)
450  {
451  (void)state.add_object(
452  ns.lookup(param).symbol_expr(),
453  [&path_storage, &frame_nr](const irep_idt &l0_name) {
454  return path_storage.get_unique_l1_index(l0_name, frame_nr);
455  },
456  ns);
457  }
458 }
symex_configt::havoc_undefined_functions
bool havoc_undefined_functions
Definition: symex_config.h:37
guard_exprt
Definition: guard_expr.h:27
goto_symext::clean_expr
exprt clean_expr(exprt expr, statet &state, bool write)
Clean up an expression.
Definition: symex_clean_expr.cpp:229
exception_utils.h
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:37
symex_targett::assignment_typet
assignment_typet
Definition: symex_target.h:70
code_typet::has_ellipsis
bool has_ellipsis() const
Definition: std_types.h:813
Forall_expr
#define Forall_expr(it, expr)
Definition: expr.h:33
goto_symext::symex_assume_l2
void symex_assume_l2(statet &, const exprt &cond)
Definition: symex_main.cpp:221
CPROVER_FKT_PREFIX
#define CPROVER_FKT_PREFIX
Definition: cprover_prefix.h:16
symex_configt::partial_loops
bool partial_loops
Definition: symex_config.h:35
symex_assign.h
Symbolic Execution of assignments.
symex_level1t::restore_from
void restore_from(const symex_level1t &other)
Insert the content of other into this renaming.
Definition: renaming_level.cpp:121
goto_symex_statet::level1
symex_level1t level1
Definition: goto_symex_state.h:75
arith_tools.h
symex_target_equationt::function_return
virtual void function_return(const exprt &guard, const irep_idt &function_id, const sourcet &source, bool hidden)
Record return from a function.
Definition: symex_target_equation.cpp:202
goto_symext::symex_function_call_code
virtual void symex_function_call_code(const get_goto_functiont &get_goto_function, statet &state, const code_function_callt &call)
Symbolic execution of a function call by inlining.
Definition: symex_function_call.cpp:223
typet
The type of an expression, extends irept.
Definition: type.h:29
fresh_symbol.h
Fresh auxiliary symbol creation.
irept::pretty
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
Definition: irep.cpp:488
symex_targett::sourcet::pc
goto_programt::const_targett pc
Definition: symex_target.h:43
expr_skeleton.h
Expression skeleton.
goto_symext::target
symex_target_equationt & target
The equation that this execution is building up.
Definition: goto_symex.h:264
path_storaget
Storage for symbolic execution paths to be resumed later.
Definition: path_storage.h:38
symbolt::type
typet type
Type of symbol.
Definition: symbol.h:31
dereference_exprt
Operator to dereference a pointer.
Definition: std_expr.h:2888
goto_symext::path_storage
path_storaget & path_storage
Symbolic execution paths to be resumed later.
Definition: goto_symex.h:796
goto_symex_statet
Central data structure: state.
Definition: goto_symex_state.h:46
framet::function_identifier
irep_idt function_identifier
Definition: frame.h:27
call_stackt::pop
void pop()
Definition: call_stack.h:36
unsupported_operation_exceptiont
Thrown when we encounter an instruction, parameters to an instruction etc.
Definition: exception_utils.h:144
framet::calling_location
symex_targett::sourcet calling_location
Definition: frame.h:29
local_safe_pointerst
A very simple, cheap analysis to determine when dereference operations are trivially guarded by a che...
Definition: local_safe_pointers.h:25
goto_symex_statet::guard_manager
guard_managert & guard_manager
Definition: goto_symex_state.h:72
symex_targett::sourcet::thread_nr
unsigned thread_nr
Definition: symex_target.h:39
goto_symext::symex_fkt
virtual void symex_fkt(statet &state, const code_function_callt &code)
Symbolically execute a FUNCTION_CALL instruction for a function whose name starts with CPROVER_FKT_PR...
Definition: symex_builtin_functions.cpp:549
prefix.h
invariant.h
exprt
Base class for all expressions.
Definition: expr.h:53
framet::guard_at_function_start
guardt guard_at_function_start
Definition: frame.h:31
goto_symex_statet::source
symex_targett::sourcet source
Definition: goto_symex_state.h:64
symex_assignt
Functor for symex assignment.
Definition: symex_assign.h:26
messaget::eom
static eomt eom
Definition: message.h:297
symbol_exprt
Expression to hold a symbol (variable)
Definition: std_expr.h:82
index_type
bitvector_typet index_type()
Definition: c_types.cpp:16
framet::hidden_function
bool hidden_function
Definition: frame.h:34
code_function_callt::lhs
exprt & lhs()
Definition: std_code.h:1208
goto_symext::symex_assign
void symex_assign(statet &state, const code_assignt &code)
Symbolically execute an ASSIGN instruction or simulate such an execution for a synthetic assignment.
Definition: goto_symex.cpp:38
goto_symext::get_unwind_recursion
virtual bool get_unwind_recursion(const irep_idt &identifier, unsigned thread_nr, unsigned unwind)
Definition: symex_function_call.cpp:34
symex_targett::assignment_typet::VISIBLE_ACTUAL_PARAMETER
@ VISIBLE_ACTUAL_PARAMETER
goto_symext::log
messaget log
The messaget to write log messages to.
Definition: goto_symex.h:276
symex_target_equationt::location
virtual void location(const exprt &guard, const sourcet &source)
Record a location.
Definition: symex_target_equation.cpp:171
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:92
byte_extract_id
irep_idt byte_extract_id()
Definition: byte_operators.cpp:13
exprt::type
typet & type()
Return the type of the expression.
Definition: expr.h:81
call_stackt::new_frame
framet & new_frame(symex_targett::sourcet calling_location, const guardt &guard)
Definition: call_stack.h:30
namespacet::lookup
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
Definition: namespace.cpp:140
code_function_callt
codet representation of a function call statement.
Definition: std_code.h:1183
irept::is_not_nil
bool is_not_nil() const
Definition: irep.h:402
sharing_mapt< irep_idt, std::pair< ssa_exprt, std::size_t > >::viewt
std::vector< view_itemt > viewt
View of the key-value pairs in the map.
Definition: sharing_map.h:365
goto_symex_statet::threads
std::vector< threadt > threads
Definition: goto_symex_state.h:198
framet::parameter_names
std::vector< irep_idt > parameter_names
Definition: frame.h:30
path_storaget::get_loop_analysis
std::shared_ptr< lexical_loopst > get_loop_analysis(const irep_idt &function_id)
Definition: path_storage.h:131
goto_symext::parameter_assignments
void parameter_assignments(const irep_idt &function_identifier, const goto_functionst::goto_functiont &goto_function, statet &state, const exprt::operandst &arguments)
Iterates over arguments and assigns them to the parameters, which are symbols whose name and type are...
Definition: symex_function_call.cpp:39
byte_operators.h
Expression classes for byte-level operators.
framet::loops_info
std::shared_ptr< lexical_loopst > loops_info
Definition: frame.h:68
goto_symex_statet::call_stack
call_stackt & call_stack()
Definition: goto_symex_state.h:147
call_stackt::top
framet & top()
Definition: call_stack.h:17
id2string
const std::string & id2string(const irep_idt &d)
Definition: irep.h:44
goto_symex_statet::symbol_table
symbol_tablet symbol_table
contains symbols that are minted during symbolic execution, such as dynamically created objects etc.
Definition: goto_symex_state.h:69
symex_targett::assignment_typet::HIDDEN_ACTUAL_PARAMETER
@ HIDDEN_ACTUAL_PARAMETER
pop_frame
static void pop_frame(goto_symext::statet &state, const path_storaget &path_storage, bool doing_path_exploration)
pop one call frame
Definition: symex_function_call.cpp:359
guard_exprt::as_expr
exprt as_expr() const
Definition: guard_expr.h:49
PRECONDITION
#define PRECONDITION(CONDITION)
Definition: invariant.h:464
symbol_exprt::get_identifier
const irep_idt & get_identifier() const
Definition: std_expr.h:111
symex_configt::doing_path_exploration
bool doing_path_exploration
Definition: symex_config.h:23
symex_configt::unwinding_assertions
bool unwinding_assertions
Definition: symex_config.h:33
incremental_dirtyt::populate_dirty_for_function
void populate_dirty_for_function(const irep_idt &id, const goto_functionst::goto_functiont &function)
Analyse the given function with dirtyt if it hasn't been seen before.
Definition: dirty.cpp:77
goto_symex.h
Symbolic Execution.
goto_statet::guard
guardt guard
Definition: goto_state.h:50
framet::loop_iterations
std::unordered_map< irep_idt, loop_infot > loop_iterations
Definition: frame.h:71
symbolt::symbol_expr
class symbol_exprt symbol_expr() const
Produces a symbol_exprt for a symbol.
Definition: symbol.cpp:122
goto_symext::symex_end_of_function
virtual void symex_end_of_function(statet &)
Symbolically execute a END_FUNCTION instruction.
Definition: symex_function_call.cpp:424
framet::return_value
exprt return_value
Definition: frame.h:33
path_storaget::dirty
incremental_dirtyt dirty
Local variables are considered 'dirty' if they've had an address taken and therefore may be referred ...
Definition: path_storage.h:116
goto_symext::symex_function_call_symbol
virtual void symex_function_call_symbol(const get_goto_functiont &get_goto_function, statet &state, const code_function_callt &code)
Symbolic execution of a call to a function call.
Definition: symex_function_call.cpp:193
to_symbol_expr
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
Definition: std_expr.h:177
code_typet
Base type of functions.
Definition: std_types.h:736
symbolt::is_parameter
bool is_parameter
Definition: symbol.h:67
irept::is_nil
bool is_nil() const
Definition: irep.h:398
irept::id
const irep_idt & id() const
Definition: irep.h:418
framet::end_of_function
goto_programt::const_targett end_of_function
Definition: frame.h:32
range.h
Ranges: pair of begin and end iterators, which can be initialized from containers,...
exprt::operandst
std::vector< exprt > operandst
Definition: expr.h:55
path_storaget::add_function_loops
void add_function_loops(const irep_idt &identifier, const goto_programt &body)
Generates a loop analysis for the instructions in goto_programt and keys it against function ID.
Definition: path_storage.h:120
false_exprt
The Boolean constant false.
Definition: std_expr.h:3964
framet
Stack frames – these are used for function calls and for exceptions.
Definition: frame.h:21
framet::old_level1
symex_level1t old_level1
Definition: frame.h:36
code_function_callt::arguments
argumentst & arguments()
Definition: std_code.h:1228
symex_transition
void symex_transition(goto_symext::statet &state)
Transition to the next instruction, which increments the internal program counter and initializes the...
Definition: symex_main.cpp:149
sharing_mapt::get_view
void get_view(viewt &view) const
Get a view of the elements in the map A view is a list of pairs with the components being const refer...
Definition: sharing_map.h:782
side_effect_expr_nondett
A side_effect_exprt that returns a non-deterministically chosen value.
Definition: std_code.h:1945
goto_functionst::goto_functiont
::goto_functiont goto_functiont
Definition: goto_functions.h:25
goto_symext::havoc_rec
void havoc_rec(statet &state, const guardt &guard, const exprt &dest)
Definition: symex_other.cpp:19
goto_symext::ns
namespacet ns
Initialized just before symbolic execution begins, to point to both outer_symbol_table and the symbol...
Definition: goto_symex.h:256
symex_configt::complexity_limits_active
bool complexity_limits_active
Whether this run of symex is under complexity limits.
Definition: symex_config.h:55
call_stackt::previous_frame
const framet & previous_frame()
Definition: call_stack.h:42
symex_level2t::current_names
symex_renaming_levelt current_names
Definition: renaming_level.h:83
path_storaget::safe_pointers
std::unordered_map< irep_idt, local_safe_pointerst > safe_pointers
Map function identifiers to local_safe_pointerst instances.
Definition: path_storage.h:100
symex_target_equationt::function_call
virtual void function_call(const exprt &guard, const irep_idt &function_id, const std::vector< renamedt< exprt, L2 >> &ssa_function_arguments, const sourcet &source, bool hidden)
Record a function call.
Definition: symex_target_equation.cpp:183
symbolt
Symbol table entry.
Definition: symbol.h:28
from_integer
constant_exprt from_integer(const mp_integer &int_value, const typet &type)
Definition: arith_tools.cpp:99
goto_statet::get_level2
const symex_level2t & get_level2() const
Definition: goto_state.h:37
goto_symext::vcc
virtual void vcc(const exprt &, const std::string &msg, statet &)
Definition: symex_main.cpp:184
goto_symext::get_goto_function
static get_goto_functiont get_goto_function(abstract_goto_modelt &goto_model)
Return a function to get/load a goto function from the given goto model Create a default delegate to ...
Definition: symex_main.cpp:493
goto_symext::symex_config
const symex_configt symex_config
The configuration to use for this symbolic execution.
Definition: goto_symex.h:183
byte_extract_exprt
Expression of type type extracted from some object op starting at position offset (given in number of...
Definition: byte_operators.h:29
framet::local_objects
std::set< irep_idt > local_objects
Definition: frame.h:38
path_storaget::get_unique_l1_index
std::size_t get_unique_l1_index(const irep_idt &id, std::size_t minimum_index)
Provide a unique L1 index for a given id, starting from minimum_index.
Definition: path_storage.h:104
goto_symext::get_goto_functiont
std::function< const goto_functionst::goto_functiont &(const irep_idt &)> get_goto_functiont
The type of delegate functions that retrieve a goto_functiont for a particular function identifier.
Definition: goto_symex.h:95
has_prefix
bool has_prefix(const std::string &s, const std::string &prefix)
Definition: converter.cpp:13
goto_symex_statet::rename
NODISCARD renamedt< exprt, level > rename(exprt expr, const namespacet &ns)
Rewrites symbol expressions in exprt, applying a suffix to each symbol reflecting its most recent ver...
goto_symext::no_body
virtual void no_body(const irep_idt &identifier)
Log a warning that a function has no body.
Definition: goto_symex.h:432
locality
static void locality(const irep_idt &function_identifier, goto_symext::statet &state, path_storaget &path_storage, const goto_functionst::goto_functiont &goto_function, const namespacet &ns)
Preserves locality of parameters of a given function by applying L1 renaming to them.
Definition: symex_function_call.cpp:438
code_assignt
A codet representing an assignment in the program.
Definition: std_code.h:295
goto_symext::symex_function_call
virtual void symex_function_call(const get_goto_functiont &get_goto_function, statet &state, const code_function_callt &code)
Symbolically execute a FUNCTION_CALL instruction.
Definition: symex_function_call.cpp:179
symex_targett::sourcet::function_id
irep_idt function_id
Definition: symex_target.h:40
true_exprt
The Boolean constant true.
Definition: std_expr.h:3955
messaget::warning
mstreamt & warning() const
Definition: message.h:404
exprt::source_location
const source_locationt & source_location() const
Definition: expr.h:254
goto_symex_statet::add_object
ssa_exprt add_object(const symbol_exprt &expr, std::function< std::size_t(const irep_idt &)> index_generator, const namespacet &ns)
Instantiate the object expr.
Definition: goto_symex_state.cpp:784
make_range
ranget< iteratort > make_range(iteratort begin, iteratort end)
Definition: range.h:524
c_types.h
get_fresh_aux_symbol
symbolt & get_fresh_aux_symbol(const typet &type, const std::string &name_prefix, const std::string &basename_prefix, const source_locationt &source_location, const irep_idt &symbol_mode, const namespacet &ns, symbol_table_baset &symbol_table)
Installs a fresh-named symbol with respect to the given namespace ns with the requested name pattern ...
Definition: fresh_symbol.cpp:32
symbolt::name
irep_idt name
The unique identifier.
Definition: symbol.h:40
guard_expr.h
Guard Data Structure.
code_function_callt::function
exprt & function()
Definition: std_code.h:1218
goto_symex_statet::drop_existing_l1_name
void drop_existing_l1_name(const irep_idt &l1_identifier)
Drops an L1 name from the local L2 map.
Definition: goto_symex_state.h:232
expr_skeletont
Expression in which some part is missing and can be substituted for another expression.
Definition: expr_skeleton.h:26
validation_modet::INVARIANT
@ INVARIANT