Skip to content

Commit 254d6ab

Browse files
committed
Assert that no longjmp is used
1 parent 001af9b commit 254d6ab

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/2ls/2ls_parse_options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ bool twols_parse_optionst::process_goto_program(
10451045
}
10461046

10471047
if(options.get_bool_option("competition-mode"))
1048-
assert_no_builtin_functions(goto_model);
1048+
assert_no_unsupported_functions(goto_model);
10491049

10501050
make_scanf_nondet(goto_model);
10511051

src/2ls/2ls_parse_options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class twols_parse_optionst:
185185
void remove_dead_goto(goto_modelt &goto_model);
186186
void memory_assert_info(goto_modelt &goto_model);
187187
void handle_freed_ptr_compare(goto_modelt &goto_model);
188-
void assert_no_builtin_functions(goto_modelt &goto_model);
188+
void assert_no_unsupported_functions(goto_modelt &goto_model);
189189
void assert_no_atexit(goto_modelt &goto_model);
190190
void fix_goto_targets(goto_modelt &goto_model);
191191
void make_assertions_false(goto_modelt &goto_model);

src/2ls/preprocessing_util.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,9 +653,12 @@ void twols_parse_optionst::handle_freed_ptr_compare(goto_modelt &goto_model)
653653
}
654654
}
655655

656-
/// Add assertions preventing analysis of programs using GCC builtin functions
657-
/// that are not supported and can cause false results.
658-
void twols_parse_optionst::assert_no_builtin_functions(goto_modelt &goto_model)
656+
/// Fail if the program contains any functions that 2LS does not currently
657+
/// support. These include:
658+
/// - builtin gcc functions
659+
/// - longjmp (not supported by CBMC)
660+
void twols_parse_optionst::assert_no_unsupported_functions(
661+
goto_modelt &goto_model)
659662
{
660663
forall_goto_program_instructions(
661664
i_it,
@@ -666,6 +669,7 @@ void twols_parse_optionst::assert_no_builtin_functions(goto_modelt &goto_model)
666669
assert(
667670
name.find("__builtin_")==std::string::npos &&
668671
name.find("__CPROVER_overflow")==std::string::npos);
672+
assert(name!="longjmp" && name!="_longjmp" && name!="siglongjmp");
669673

670674
if(i_it->is_assign())
671675
{

0 commit comments

Comments
 (0)