@@ -68,13 +68,29 @@ void goto_analyzer_parse_optionst::set_default_analysis_flags(
6868 options.set_option (" signed-overflow-check" , enabled);
6969 options.set_option (" undefined-shift-check" , enabled);
7070
71+ if (enabled)
72+ {
73+ config.ansi_c .malloc_may_fail = true ;
74+ config.ansi_c .malloc_failure_mode =
75+ configt::ansi_ct::malloc_failure_modet::malloc_failure_mode_return_null;
76+ }
77+ else
78+ {
79+ config.ansi_c .malloc_may_fail = false ;
80+ config.ansi_c .malloc_failure_mode =
81+ configt::ansi_ct::malloc_failure_modet::malloc_failure_mode_none;
82+ }
83+
7184 // This is in-line with the options we set for CBMC in cbmc_parse_optionst
7285 // with the exception of unwinding-assertions, which don't make sense in
7386 // the context of abstract interpretation.
7487}
7588
7689void goto_analyzer_parse_optionst::get_command_line_options (optionst &options)
7790{
91+ goto_analyzer_parse_optionst::set_default_analysis_flags (
92+ options, !cmdline.isset (" no-standard-checks" ));
93+
7894 if (config.set (cmdline))
7995 {
8096 usage_error ();
@@ -84,9 +100,6 @@ void goto_analyzer_parse_optionst::get_command_line_options(optionst &options)
84100 if (cmdline.isset (" function" ))
85101 options.set_option (" function" , cmdline.get_value (" function" ));
86102
87- goto_analyzer_parse_optionst::set_default_analysis_flags (
88- options, !cmdline.isset (" no-standard-checks" ));
89-
90103 // all (other) checks supported by goto_check
91104 PARSE_OPTIONS_GOTO_CHECK (cmdline, options);
92105
0 commit comments