Skip to content

Commit 456879f

Browse files
committed
Skip check for unsoundness in shared pointer handling (java only)
If the 'java-threading' option is specified this commit 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 (until the concurrency encoding is fixed).
1 parent 8e6244c commit 456879f

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

jbmc/src/jbmc/jbmc_parse_options.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,9 @@ void jbmc_parse_optionst::get_command_line_options(optionst &options)
399399
}
400400
}
401401
}
402+
403+
if(cmdline.isset("java-threading"))
404+
options.set_option("java-threading", true);
402405
}
403406

404407
/// invoke main modules

src/goto-symex/goto_symex_state.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ void goto_symex_statet::assignment(
311311
const exprt &rhs, // L2
312312
const namespacet &ns,
313313
bool rhs_is_simplified,
314-
bool record_value)
314+
bool record_value,
315+
bool allow_unsound_pointer_handling)
315316
{
316317
// identifier should be l0 or l1, make sure it's l1
317318
rename(lhs, ns, L1);
@@ -343,7 +344,9 @@ void goto_symex_statet::assignment(
343344
assert_l2_renaming(rhs);
344345

345346
// see #305 on GitHub for a simple example and possible discussion
346-
if(is_shared && lhs.type().id() == ID_pointer)
347+
if(is_shared &&
348+
lhs.type().id() == ID_pointer &&
349+
!allow_unsound_pointer_handling)
347350
throw "pointer handling for concurrency is unsound";
348351

349352
// for value propagation -- the RHS is L2

src/goto-symex/goto_symex_state.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ class goto_symex_statet final
175175
const exprt &rhs, // L2
176176
const namespacet &ns,
177177
bool rhs_is_simplified,
178-
bool record_value);
178+
bool record_value,
179+
bool allow_unsound_pointer_handling=false);
179180

180181
// what to propagate
181182
bool constant_propagation(const exprt &expr) const;

src/goto-symex/symex_assign.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ void goto_symext::symex_assign_symbol(
232232
ssa_rhs,
233233
ns,
234234
options.get_bool_option("simplify"),
235-
constant_propagation);
235+
constant_propagation,
236+
options.get_bool_option("java-threading"));
236237

237238
exprt ssa_full_lhs=full_lhs;
238239
ssa_full_lhs=add_to_lhs(ssa_full_lhs, ssa_lhs);

0 commit comments

Comments
 (0)