Skip to content

Commit

Permalink
Merge pull request diffblue#2354 from Degiorgio/disable-soundness-che…
Browse files Browse the repository at this point in the history
…ck-for-shared-pointers

Skip check for unsoundness in shared pointer handling (java only)
  • Loading branch information
cesaro authored Jun 15, 2018
2 parents 8e6244c + 7d4d4bd commit e5d1c12
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
8 changes: 8 additions & 0 deletions jbmc/src/jbmc/jbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,14 @@ void jbmc_parse_optionst::get_command_line_options(optionst &options)
}
}
}

// The 'allow-pointer-unsoundness' option prevents symex from throwing an
// exception when it encounters pointers that are shared across threads.
// This is unsound but given that pointers are ubiquitous in java this check
// must be disabled in order to support the analysis of multithreaded java
// code.
if(cmdline.isset("java-threading"))
options.set_option("allow-pointer-unsoundness", true);
}

/// invoke main modules
Expand Down
3 changes: 3 additions & 0 deletions src/goto-symex/goto_symex.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class goto_symext
options(options),
max_depth(options.get_unsigned_int_option("depth")),
doing_path_exploration(options.is_set("paths")),
allow_pointer_unsoundness(
options.get_bool_option("allow-pointer-unsoundness")),
total_vccs(0),
remaining_vccs(0),
constant_propagation(true),
Expand Down Expand Up @@ -201,6 +203,7 @@ class goto_symext

const unsigned max_depth;
const bool doing_path_exploration;
const bool allow_pointer_unsoundness;

public:
// these bypass the target maps
Expand Down
5 changes: 3 additions & 2 deletions src/goto-symex/goto_symex_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ void goto_symex_statet::assignment(
const exprt &rhs, // L2
const namespacet &ns,
bool rhs_is_simplified,
bool record_value)
bool record_value,
bool allow_pointer_unsoundness)
{
// identifier should be l0 or l1, make sure it's l1
rename(lhs, ns, L1);
Expand Down Expand Up @@ -343,7 +344,7 @@ void goto_symex_statet::assignment(
assert_l2_renaming(rhs);

// see #305 on GitHub for a simple example and possible discussion
if(is_shared && lhs.type().id() == ID_pointer)
if(is_shared && lhs.type().id() == ID_pointer && !allow_pointer_unsoundness)
throw "pointer handling for concurrency is unsound";

// for value propagation -- the RHS is L2
Expand Down
3 changes: 2 additions & 1 deletion src/goto-symex/goto_symex_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ class goto_symex_statet final
const exprt &rhs, // L2
const namespacet &ns,
bool rhs_is_simplified,
bool record_value);
bool record_value,
bool allow_pointer_unsoundness=false);

// what to propagate
bool constant_propagation(const exprt &expr) const;
Expand Down
3 changes: 2 additions & 1 deletion src/goto-symex/symex_assign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ void goto_symext::symex_assign_symbol(
ssa_rhs,
ns,
options.get_bool_option("simplify"),
constant_propagation);
constant_propagation,
allow_pointer_unsoundness);

exprt ssa_full_lhs=full_lhs;
ssa_full_lhs=add_to_lhs(ssa_full_lhs, ssa_lhs);
Expand Down

0 comments on commit e5d1c12

Please sign in to comment.