File tree 5 files changed +18
-4
lines changed
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)
399
399
}
400
400
}
401
401
}
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 );
402
410
}
403
411
404
412
// / invoke main modules
Original file line number Diff line number Diff line change @@ -58,6 +58,8 @@ class goto_symext
58
58
options (options),
59
59
max_depth(options.get_unsigned_int_option(" depth" )),
60
60
doing_path_exploration(options.is_set(" paths" )),
61
+ allow_pointer_unsoundness(
62
+ options.get_bool_option(" allow-pointer-unsoundness" )),
61
63
total_vccs(0 ),
62
64
remaining_vccs(0 ),
63
65
constant_propagation(true ),
@@ -201,6 +203,7 @@ class goto_symext
201
203
202
204
const unsigned max_depth;
203
205
const bool doing_path_exploration;
206
+ const bool allow_pointer_unsoundness;
204
207
205
208
public:
206
209
// these bypass the target maps
Original file line number Diff line number Diff line change @@ -311,7 +311,8 @@ void goto_symex_statet::assignment(
311
311
const exprt &rhs, // L2
312
312
const namespacet &ns,
313
313
bool rhs_is_simplified,
314
- bool record_value)
314
+ bool record_value,
315
+ bool allow_pointer_unsoundness)
315
316
{
316
317
// identifier should be l0 or l1, make sure it's l1
317
318
rename (lhs, ns, L1);
@@ -343,7 +344,7 @@ void goto_symex_statet::assignment(
343
344
assert_l2_renaming (rhs);
344
345
345
346
// 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 )
347
348
throw " pointer handling for concurrency is unsound" ;
348
349
349
350
// 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
175
175
const exprt &rhs, // L2
176
176
const namespacet &ns,
177
177
bool rhs_is_simplified,
178
- bool record_value);
178
+ bool record_value,
179
+ bool allow_pointer_unsoundness=false );
179
180
180
181
// what to propagate
181
182
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(
232
232
ssa_rhs,
233
233
ns,
234
234
options.get_bool_option (" simplify" ),
235
- constant_propagation);
235
+ constant_propagation,
236
+ allow_pointer_unsoundness);
236
237
237
238
exprt ssa_full_lhs=full_lhs;
238
239
ssa_full_lhs=add_to_lhs (ssa_full_lhs, ssa_lhs);
You can’t perform that action at this time.
0 commit comments