Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark constant_exprt::value_is_zero_string protected #8455

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/goto-programs/json_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static exprt simplify_json_expr(const exprt &src)
}
else if(
object.id() == ID_index && to_index_expr(object).index().is_constant() &&
to_constant_expr(to_index_expr(object).index()).value_is_zero_string())
to_constant_expr(to_index_expr(object).index()).is_zero())
{
// simplify expressions of the form &array[0]
return simplify_json_expr(to_index_expr(object).array());
Expand Down
2 changes: 1 addition & 1 deletion src/util/simplify_expr_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ simplify_exprt::simplify_bitwise(const multi_ary_exprt &expr)
}
else if(
it->is_constant() && it->type().id() == ID_bv &&
to_constant_expr(*it).value_is_zero_string() &&
*it == to_bv_type(it->type()).all_zeros_expr() &&
new_expr.operands().size() > 1)
{
it = new_expr.operands().erase(it);
Expand Down
5 changes: 3 additions & 2 deletions src/util/std_expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -3005,8 +3005,6 @@ class constant_exprt : public nullary_exprt
set(ID_value, value);
}

bool value_is_zero_string() const;

/// Returns true if \p expr has a pointer type and a value NULL; it also
/// returns true when \p expr has value zero and NULL_is_zero is true; returns
/// false in all other cases.
Expand All @@ -3023,6 +3021,9 @@ class constant_exprt : public nullary_exprt
{
check(expr, vm);
}

protected:
bool value_is_zero_string() const;
};

template <>
Expand Down
3 changes: 1 addition & 2 deletions unit/goto-symex/goto_symex_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ SCENARIO(
const symbol_exprt object_symbol =
to_symbol_expr(object_descriptor->object());
REQUIRE(object_symbol.get_identifier() == "int_value!0");
REQUIRE(to_constant_expr(object_descriptor->offset())
.value_is_zero_string());
REQUIRE(to_constant_expr(object_descriptor->offset()).is_zero());
}
THEN("The target equations are unchanged")
{
Expand Down
Loading