Skip to content

Commit e5e2cc4

Browse files
committed
Added check that resulting GOTO binaries do not contain 'x=NONDET(T*)'.
Updates requested in the review.
1 parent 212e471 commit e5e2cc4

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

src/driver/sec_driver_parse_options.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,10 +513,7 @@ void sec_driver_parse_optionst::process_goto_function(
513513
replace_java_nondet(function);
514514

515515
convert_nondet(
516-
function,
517-
get_message_handler(),
518-
object_factory_params,
519-
ID_java);
516+
function, get_message_handler(), object_factory_params, ID_java);
520517

521518
adjust_float_expressions(goto_function, namespacet(symbol_table));
522519

@@ -642,7 +639,7 @@ bool sec_driver_parse_optionst::generate_function_body(
642639
if(body_available || !can_generate_function_body(function_name))
643640
{
644641
const symbolt *symbol = symbol_table.lookup(function_name);
645-
if (symbol == nullptr || !symbol->type.get_bool(ID_C_abstract))
642+
if(symbol == nullptr || !symbol->type.get_bool(ID_C_abstract))
646643
return false;
647644
}
648645

src/taint-slicer/slicing_tasks_builder.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,22 @@ std::pair<taint_slicing_taskt,std::string> build_slicing_task(
326326
I.function=fname_prog.first;
327327
}
328328

329+
// Check that the goto program to be saved does not contain any NONDET(T*)
330+
// expressions. However, non-pointer NONDET expressions can be present.
331+
class nondet_visitort : public const_expr_visitort
332+
{
333+
public:
334+
void operator()(const exprt &expr) override
335+
{
336+
INVARIANT(
337+
expr.id() != ID_nondet || expr.type().id() != ID_pointer,
338+
"No pointer-typed NONDET allowed.");
339+
}
340+
} visitor;
341+
for(auto &fname_prog : goto_functions.function_map)
342+
for(const auto &I : fname_prog.second.body.instructions)
343+
I.code.visit(visitor);
344+
329345
// Finally save the constructed slicing task on the disc as GOTO program
330346
// binary.
331347
const bool fail=write_goto_binary(

0 commit comments

Comments
 (0)