Skip to content

Commit

Permalink
Merge pull request #145 from viktormalik/svcomp21-backport
Browse files Browse the repository at this point in the history
SV-COMP'21 backport
  • Loading branch information
peterschrammel committed Dec 17, 2020
2 parents b856541 + f56f679 commit 53d901c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/cbmc
3 changes: 3 additions & 0 deletions src/2ls/2ls_parse_options.cpp
Expand Up @@ -1071,6 +1071,9 @@ bool twols_parse_optionst::process_goto_program(
// remove returns (must be done after function pointer removal)
remove_returns(goto_model);

if(options.get_bool_option("competition-mode"))
assert_no_atexit(goto_model);

// now do full inlining, if requested
if(options.get_bool_option("inline"))
{
Expand Down
1 change: 1 addition & 0 deletions src/2ls/2ls_parse_options.h
Expand Up @@ -208,6 +208,7 @@ class twols_parse_optionst:
void memory_assert_info(goto_modelt &goto_model);
void handle_freed_ptr_compare(goto_modelt &goto_model);
void assert_no_builtin_functions(goto_modelt &goto_model);
void assert_no_atexit(goto_modelt &goto_model);
};

#endif
20 changes: 20 additions & 0 deletions src/2ls/preprocessing_util.cpp
Expand Up @@ -811,3 +811,23 @@ void twols_parse_optionst::assert_no_builtin_functions(goto_modelt &goto_model)
}
}
}

/// Prevents usage of atexit function which is not supported, yet
/// Must be called before inlining since it will lose the calls
void twols_parse_optionst::assert_no_atexit(goto_modelt &goto_model)
{
forall_goto_functions(f_it, goto_model.goto_functions)
{
forall_goto_program_instructions(i_it, f_it->second.body)
{
if(i_it->is_function_call())
{
auto &call=to_code_function_call(i_it->code);
if(!(call.function().id()==ID_symbol))
continue;
auto &name=id2string(to_symbol_expr(call.function()).get_identifier());
assert(name!="atexit");
}
}
}
}
2 changes: 1 addition & 1 deletion src/2ls/version.h
Expand Up @@ -12,6 +12,6 @@ Author: Peter Schrammel
#ifndef CPROVER_2LS_2LS_VERSION_H
#define CPROVER_2LS_2LS_VERSION_H

#define TWOLS_VERSION "0.9.0"
#define TWOLS_VERSION "0.9.1"

#endif

0 comments on commit 53d901c

Please sign in to comment.