Skip to content

SV-COMP'21 backport #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/cbmc
3 changes: 3 additions & 0 deletions src/2ls/2ls_parse_options.cpp
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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