File tree Expand file tree Collapse file tree 5 files changed +18
-4
lines changed Expand file tree Collapse file tree 5 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -399,6 +399,14 @@ void jbmc_parse_optionst::get_command_line_options(optionst &options)
399399 }
400400 }
401401 }
402+
403+ // The 'allow-pointer-unsoundness' option prevents symex from throwing an
404+ // exception when it encounters pointers that are shared across threads.
405+ // This is unsound but given that pointers are ubiquitous in java this check
406+ // must be disabled in order to support the analysis of multithreaded java
407+ // code.
408+ if (cmdline.isset (" java-threading" ))
409+ options.set_option (" allow-pointer-unsoundness" , true );
402410}
403411
404412// / invoke main modules
Original file line number Diff line number Diff line change @@ -58,6 +58,8 @@ class goto_symext
5858 options (options),
5959 max_depth(options.get_unsigned_int_option(" depth" )),
6060 doing_path_exploration(options.is_set(" paths" )),
61+ allow_pointer_unsoundness(
62+ options.get_bool_option(" allow-pointer-unsoundness" )),
6163 total_vccs(0 ),
6264 remaining_vccs(0 ),
6365 constant_propagation(true ),
@@ -201,6 +203,7 @@ class goto_symext
201203
202204 const unsigned max_depth;
203205 const bool doing_path_exploration;
206+ const bool allow_pointer_unsoundness;
204207
205208public:
206209 // these bypass the target maps
Original file line number Diff line number Diff 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_pointer_unsoundness)
315316{
316317 // identifier should be l0 or l1, make sure it's l1
317318 rename (lhs, ns, L1);
@@ -343,7 +344,7 @@ 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 && lhs.type ().id () == ID_pointer && !allow_pointer_unsoundness )
347348 throw " pointer handling for concurrency is unsound" ;
348349
349350 // for value propagation -- the RHS is L2
Original file line number Diff line number Diff 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_pointer_unsoundness=false );
179180
180181 // what to propagate
181182 bool constant_propagation (const exprt &expr) const ;
Original file line number Diff line number Diff 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+ allow_pointer_unsoundness);
236237
237238 exprt ssa_full_lhs=full_lhs;
238239 ssa_full_lhs=add_to_lhs (ssa_full_lhs, ssa_lhs);
You can’t perform that action at this time.
0 commit comments