Skip to content

Commit aea6b8e

Browse files
Add commented out code relating to --malloc-may-fail
Also add some explanation for why it’s commented out
1 parent e0eee9d commit aea6b8e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

jbmc/src/jbmc/jbmc_parse_options.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,10 @@ int jbmc_parse_optionst::get_goto_program(
726726

727727
goto_modelt &goto_model = dynamic_cast<goto_modelt &>(*goto_model_ptr);
728728

729+
// if we added the ansi-c library models here this should also call
730+
// add_malloc_may_fail_variable_initializations(goto_model);
731+
// here
732+
729733
if(cmdline.isset("validate-goto-model"))
730734
{
731735
goto_model.validate();

src/goto-analyzer/goto_analyzer_parse_options.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Author: Daniel Kroening, [email protected]
2626

2727
#include <jsil/jsil_language.h>
2828

29+
#include <goto-programs/add_malloc_may_fail_variable_initializations.h>
2930
#include <goto-programs/adjust_float_expressions.h>
3031
#include <goto-programs/goto_convert_functions.h>
3132
#include <goto-programs/goto_inline.h>
@@ -814,7 +815,12 @@ bool goto_analyzer_parse_optionst::process_goto_program(
814815
link_to_library(
815816
goto_model, ui_message_handler, cprover_cpp_library_factory);
816817
link_to_library(goto_model, ui_message_handler, cprover_c_library_factory);
817-
#endif
818+
819+
// these are commented out as well because without the library
820+
// this initialization code doesn’t make any sense
821+
add_malloc_may_fail_variable_initializations(goto_model);
822+
823+
#endif
818824

819825
// remove function pointers
820826
log.status() << "Removing function pointers and virtual functions"

0 commit comments

Comments
 (0)