@@ -120,7 +120,12 @@ void cbmc_parse_optionst::set_default_analysis_flags(
120120
121121 // Unwinding assertions required in certain cases for sound verification
122122 // results. See https://github.com/diffblue/cbmc/issues/6561 for elaboration.
123- options.set_option (" unwinding-assertions" , enabled);
123+ // As the unwinding-assertions is processed earlier, we set it only if it has
124+ // not been set yet.
125+ if (!options.is_set (" unwinding-assertions" ))
126+ {
127+ options.set_option (" unwinding-assertions" , enabled);
128+ }
124129}
125130
126131void cbmc_parse_optionst::get_command_line_options (optionst &options)
@@ -145,6 +150,35 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
145150 exit (CPROVER_EXIT_USAGE_ERROR);
146151 }
147152
153+ // We want to warn the user that if we are using standard checks (that enables
154+ // unwinding-assertions) and we did not disable them manually.
155+ if (
156+ cmdline.isset (" cover" ) && !cmdline.isset (" no-standard-checks" ) &&
157+ !cmdline.isset (" no-unwinding-assertions" ))
158+ {
159+ log.warning () << " --cover is incompatible with --unwinding-assertions, so "
160+ " unwinding-assertions will be defaulted to false"
161+ << messaget::eom;
162+ }
163+
164+ // We want to set the unwinding-assertions option as early as we can,
165+ // otherwise we come across two issues: 1) there's no way to deactivate it
166+ // with `--no-unwinding-assertions`, as the `--no-xxx` flags are set by
167+ // `goto_check_c` which doesn't provide handling for the options, and 2) we
168+ // handle it only when we use `--no-standard-checks`, but if we do so, we have
169+ // already printed a couple times to the screen that `--unwinding-assertions`
170+ // must be passed because of some activation/sensitive further down below.
171+ if (cmdline.isset (" unwinding-assertions" ))
172+ {
173+ options.set_option (" unwinding-assertions" , true );
174+ options.set_option (" paths-symex-explore-all" , true );
175+ }
176+ else if (cmdline.isset (" no-unwinding-assertions" ))
177+ {
178+ options.set_option (" unwinding-assertions" , false );
179+ options.set_option (" paths-symex-explore-all" , false );
180+ }
181+
148182 if (cmdline.isset (" max-field-sensitivity-array-size" ))
149183 {
150184 options.set_option (
@@ -340,15 +374,6 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
340374 // all (other) checks supported by goto_check
341375 PARSE_OPTIONS_GOTO_CHECK (cmdline, options);
342376
343- // generate unwinding assertions
344- if (
345- options.get_bool_option (" unwinding-assertions" ) ||
346- cmdline.isset (" unwinding-assertions" ))
347- {
348- options.set_option (" unwinding-assertions" , true );
349- options.set_option (" paths-symex-explore-all" , true );
350- }
351-
352377 if (cmdline.isset (" partial-loops" ))
353378 {
354379 options.set_option (" partial-loops" , true );
0 commit comments