Skip to content

Commit 9d14448

Browse files
authored
Merge pull request #8455 from tautschnig/protect-value_is_zero_string
Mark constant_exprt::value_is_zero_string protected [depends-on: 8675]
2 parents 06665e7 + 8cc6337 commit 9d14448

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

src/goto-programs/json_expr.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ static exprt simplify_json_expr(const exprt &src)
5151
// simplify expressions of the form &member(object, @class_identifier)
5252
return simplify_json_expr(object);
5353
}
54-
else if(
55-
object.id() == ID_index && to_index_expr(object).index().is_constant() &&
56-
to_constant_expr(to_index_expr(object).index()).value_is_zero_string())
54+
else if(object.id() == ID_index && to_index_expr(object).index() == 0)
5755
{
5856
// simplify expressions of the form &array[0]
5957
return simplify_json_expr(to_index_expr(object).array());

src/util/simplify_expr_int.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ simplify_exprt::simplify_bitwise(const multi_ary_exprt &expr)
782782
}
783783
else if(
784784
it->is_constant() && it->type().id() == ID_bv &&
785-
to_constant_expr(*it).value_is_zero_string() &&
785+
*it == to_bv_type(it->type()).all_zeros_expr() &&
786786
new_expr.operands().size() > 1)
787787
{
788788
it = new_expr.operands().erase(it);

src/util/std_expr.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3133,8 +3133,6 @@ class constant_exprt : public nullary_exprt
31333133
set(ID_value, value);
31343134
}
31353135

3136-
bool value_is_zero_string() const;
3137-
31383136
/// Returns true if \p expr has a pointer type and a value NULL; it also
31393137
/// returns true when \p expr has value zero and NULL_is_zero is true; returns
31403138
/// false in all other cases.
@@ -3166,6 +3164,9 @@ class constant_exprt : public nullary_exprt
31663164
{
31673165
check(expr, vm);
31683166
}
3167+
3168+
protected:
3169+
bool value_is_zero_string() const;
31693170
};
31703171

31713172
template <>

unit/goto-symex/goto_symex_state.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ SCENARIO(
173173
const symbol_exprt object_symbol =
174174
to_symbol_expr(object_descriptor->object());
175175
REQUIRE(object_symbol.get_identifier() == "int_value!0");
176-
REQUIRE(to_constant_expr(object_descriptor->offset())
177-
.value_is_zero_string());
176+
REQUIRE(object_descriptor->offset() == 0);
178177
}
179178
THEN("The target equations are unchanged")
180179
{

0 commit comments

Comments
 (0)