Skip to content

Commit ca78842

Browse files
Document how arrays are handled by field sensitivity
This explains how field sensitivity transforms instructions that contain array operations.
1 parent c93c1ca commit ca78842

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

src/goto-symex/field_sensitivity.h

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ class symex_targett;
2828
/// Note that field sensitivity is not applied as a single pass over the
2929
/// whole goto program but instead applied as the symbolic execution unfolds.
3030
///
31-
/// On a high level, field sensitivity replaces member operators with atomic
32-
/// symbols representing a field when possible. In cases where this is not
33-
/// immediately possible, like struct assignments, some things need to be added.
31+
/// On a high level, field sensitivity replaces member operators, and array
32+
/// accesses with atomic symbols representing a field when possible.
33+
/// In cases where this is not immediately possible, like struct assignments,
34+
/// some things need to be added.
3435
/// The possible cases are described below.
3536
///
3637
/// ### Member access
@@ -52,6 +53,30 @@ class symex_targett;
5253
/// `struct_expr..field_name1 = other_struct..field_name1;`
5354
/// `struct_expr..field_name2 = other_struct..field_name2;` etc.
5455
/// See \ref field_sensitivityt::field_assignments.
56+
///
57+
/// ### Array access
58+
/// An index expression `array[index]` when index is constant and array has
59+
/// constant size is replaced by the symbol `array[[index]]`; note the use
60+
/// of `[[` and `]]` to visually distinguish the symbol from the index
61+
/// expression.
62+
/// When `index` is not a constant, `array[index]` is replaced by
63+
/// `{array[[0]]; array[[1]]; …index]`.
64+
/// Note that this process does not apply to arrays whose size is not constant,
65+
/// and arrays whose size exceed the bound \ref MAX_FIELD_SENSITIVITY_ARRAY_SIZE
66+
/// See \ref field_sensitivityt::apply.
67+
///
68+
/// ### Symbols representing arrays
69+
/// In an rvalue, a symbol `array` which has array type will be replaced by
70+
/// `{array[[0]]; array[[1]]; …}[index]`.
71+
/// See \ref field_sensitivityt::get_fields.
72+
///
73+
/// ### Assignment to an array
74+
/// When the array symbol is on the left-hand-side, for instance for
75+
/// an assignment `array = other_array`, the assignment is replaced by a
76+
/// sequence of assignments:
77+
/// `array[[0]] = other_array[[0]]`;
78+
/// `array[[1]] = other_array[[1]]`; etc.
79+
/// See \ref field_sensitivityt::field_assignments.
5580
class field_sensitivityt
5681
{
5782
public:

0 commit comments

Comments
 (0)