Skip to content
Closed
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
8 changes: 8 additions & 0 deletions regression/cbmc/Pointer_byte_extract5/program-only.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
--bounds-check --32 --program-only
^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
byte_update
15 changes: 15 additions & 0 deletions src/goto-symex/symex_assign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Author: Daniel Kroening, [email protected]
#include <util/byte_operators.h>
#include <util/c_types.h>
#include <util/cprover_prefix.h>
#include <util/expr_util.h>
#include <util/invariant.h>
#include <util/pointer_offset_size.h>

#include "goto_symex_state.h"
Expand All @@ -28,6 +30,19 @@ void goto_symext::symex_assign(
exprt rhs=code.rhs();

clean_expr(lhs, state, true);
// make the structure of the lhs as simple as possible to avoid,
// e.g., (b ? s1 : s2).member=X resulting in
// (b ? s1 : s2)=(b ? s1 : s2) with member:=X and then
// s1=b ? ((b ? s1 : s2) with member:=X) : s1
// when all we need is
// s1=s1 with member:=X [and guard b]
// s2=s2 with member:=X [and guard !b]
do_simplify(lhs);
// make sure simplify has not re-introduced any dereferencing that
// had previously been cleaned away
INVARIANT(
!has_subexpr(lhs, ID_dereference),
"simplify re-introduced dereferencing");
clean_expr(rhs, state, false);

if(rhs.id()==ID_side_effect)
Expand Down