Skip to content

Commit 53d901c

Browse files
Merge pull request #145 from viktormalik/svcomp21-backport
SV-COMP'21 backport
2 parents b856541 + f56f679 commit 53d901c

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed

src/2ls/2ls_parse_options.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,9 @@ bool twols_parse_optionst::process_goto_program(
10711071
// remove returns (must be done after function pointer removal)
10721072
remove_returns(goto_model);
10731073

1074+
if(options.get_bool_option("competition-mode"))
1075+
assert_no_atexit(goto_model);
1076+
10741077
// now do full inlining, if requested
10751078
if(options.get_bool_option("inline"))
10761079
{

src/2ls/2ls_parse_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ class twols_parse_optionst:
208208
void memory_assert_info(goto_modelt &goto_model);
209209
void handle_freed_ptr_compare(goto_modelt &goto_model);
210210
void assert_no_builtin_functions(goto_modelt &goto_model);
211+
void assert_no_atexit(goto_modelt &goto_model);
211212
};
212213

213214
#endif

src/2ls/preprocessing_util.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,3 +811,23 @@ void twols_parse_optionst::assert_no_builtin_functions(goto_modelt &goto_model)
811811
}
812812
}
813813
}
814+
815+
/// Prevents usage of atexit function which is not supported, yet
816+
/// Must be called before inlining since it will lose the calls
817+
void twols_parse_optionst::assert_no_atexit(goto_modelt &goto_model)
818+
{
819+
forall_goto_functions(f_it, goto_model.goto_functions)
820+
{
821+
forall_goto_program_instructions(i_it, f_it->second.body)
822+
{
823+
if(i_it->is_function_call())
824+
{
825+
auto &call=to_code_function_call(i_it->code);
826+
if(!(call.function().id()==ID_symbol))
827+
continue;
828+
auto &name=id2string(to_symbol_expr(call.function()).get_identifier());
829+
assert(name!="atexit");
830+
}
831+
}
832+
}
833+
}

src/2ls/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ Author: Peter Schrammel
1212
#ifndef CPROVER_2LS_2LS_VERSION_H
1313
#define CPROVER_2LS_2LS_VERSION_H
1414

15-
#define TWOLS_VERSION "0.9.0"
15+
#define TWOLS_VERSION "0.9.1"
1616

1717
#endif

0 commit comments

Comments
 (0)