@@ -93,6 +93,9 @@ ::cbmc_parse_optionst::cbmc_parse_optionst(
93
93
94
94
void cbmc_parse_optionst::set_default_options (optionst &options)
95
95
{
96
+ // Enable the standard checks by default, unless a user overrides.
97
+ options.set_option (" standard-checks" , true );
98
+
96
99
// Default true
97
100
options.set_option (" built-in-assertions" , true );
98
101
options.set_option (" propagation" , true );
@@ -107,6 +110,20 @@ void cbmc_parse_optionst::set_default_options(optionst &options)
107
110
options.set_option (" depth" , UINT32_MAX);
108
111
}
109
112
113
+ void cbmc_parse_optionst::set_soundness_on_by_default (optionst &options)
114
+ {
115
+ // Analysis flags on by default
116
+ options.set_option (" bounds-check" , true );
117
+ options.set_option (" pointer-check" , true );
118
+ options.set_option (" pointer-primitive-check" , true );
119
+ options.set_option (" malloc-may-fail" , true );
120
+ // TODO: Default malloc-fail-profile
121
+ options.set_option (" div-by-zero-check" , true );
122
+ options.set_option (" signed-overflow-check" , true );
123
+ options.set_option (" undefined-shift-check" , true );
124
+ options.set_option (" unwinding-assertions" , true );
125
+ }
126
+
110
127
void cbmc_parse_optionst::get_command_line_options (optionst &options)
111
128
{
112
129
if (config.set (cmdline))
@@ -118,6 +135,11 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
118
135
cbmc_parse_optionst::set_default_options (options);
119
136
parse_c_object_factory_options (cmdline, options);
120
137
138
+ // Enable flags that in combination provide analysis with no surprises
139
+ // (expected checks and no unsoundness by missing checks).
140
+ if (options.get_bool_option (" standard-checks" ))
141
+ set_soundness_on_by_default (options);
142
+
121
143
if (cmdline.isset (" function" ))
122
144
options.set_option (" function" , cmdline.get_value (" function" ));
123
145
@@ -310,8 +332,14 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
310
332
PARSE_OPTIONS_GOTO_CHECK (cmdline, options);
311
333
312
334
// generate unwinding assertions
313
- if (cmdline.isset (" unwinding-assertions" ))
335
+ // TODO: Fotis: revisit
336
+ if (cmdline.isset (" no-unwinding-assertions" ))
314
337
{
338
+ options.set_option (" unwinding-assertions" , false );
339
+ options.set_option (" paths-symex-explore-all" , false );
340
+ } else {
341
+ // Not really needed, as it's now on by default, but keeping it here
342
+ // for completeness' sake.
315
343
options.set_option (" unwinding-assertions" , true );
316
344
options.set_option (" paths-symex-explore-all" , true );
317
345
}
0 commit comments