Skip to content

Commit 0beaf25

Browse files
authored
Merge pull request #8647 from tautschnig/value-set-offset
Value set: lift offset from numeric constants to expressions
2 parents eef9677 + 056be83 commit 0beaf25

File tree

6 files changed

+253
-124
lines changed

6 files changed

+253
-124
lines changed

regression/cbmc/trace-values/unbounded_array.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ int main(int argc, char *argv[])
66
unsigned long size;
77
__CPROVER_assume(size < 100 && size > 10);
88
int *array = malloc(size * sizeof(int));
9+
__CPROVER_assume(array);
910
array[size - 1] = 42;
1011
int fixed_array[] = {1, 2};
1112
__CPROVER_array_replace(array, fixed_array);

src/goto-symex/goto_symex_state.cpp

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ Author: Daniel Kroening, [email protected]
2727
#include "simplify_expr_with_value_set.h"
2828
#include "symex_target_equation.h"
2929

30-
static void get_l1_name(exprt &expr);
31-
3230
goto_symex_statet::goto_symex_statet(
3331
const symex_targett::sourcet &_source,
3432
std::size_t max_field_sensitive_array_size,
@@ -129,20 +127,7 @@ renamedt<ssa_exprt, L2> goto_symex_statet::assignment(
129127
else
130128
propagation.erase_if_exists(l1_identifier);
131129

132-
{
133-
// update value sets
134-
exprt l1_rhs(rhs);
135-
get_l1_name(l1_rhs);
136-
137-
const ssa_exprt l1_lhs = remove_level_2(lhs);
138-
if(run_validation_checks)
139-
{
140-
DATA_INVARIANT(!check_renaming_l1(l1_lhs), "lhs renaming failed on l1");
141-
DATA_INVARIANT(!check_renaming_l1(l1_rhs), "rhs renaming failed on l1");
142-
}
143-
144-
value_set.assign(l1_lhs, l1_rhs, ns, rhs_is_simplified, is_shared);
145-
}
130+
value_set.assign(lhs, rhs, ns, rhs_is_simplified, is_shared);
146131

147132
#ifdef DEBUG
148133
std::cout << "Assigning " << l1_identifier << '\n';
@@ -789,17 +774,6 @@ void goto_symex_statet::rename(
789774
l1_type_entry.first->second=type;
790775
}
791776

792-
static void get_l1_name(exprt &expr)
793-
{
794-
// do not reset the type !
795-
796-
if(is_ssa_expr(expr))
797-
to_ssa_expr(expr).remove_level_2();
798-
else
799-
Forall_operands(it, expr)
800-
get_l1_name(*it);
801-
}
802-
803777
/// Dumps the current state of symex, printing the function name and location
804778
/// number for each stack frame in the currently active thread.
805779
/// This is for use from the debugger or in debug code; please don't delete it

src/goto-symex/shadow_memory_util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ normalize(const object_descriptor_exprt &expr, const namespacet &ns)
982982
{
983983
return expr;
984984
}
985-
if(expr.offset().id() == ID_unknown)
985+
if(!expr.offset().is_constant())
986986
{
987987
return expr;
988988
}

0 commit comments

Comments
 (0)