@@ -1148,16 +1148,6 @@ void goto_instrument_parse_optionst::instrument_goto_program()
1148
1148
goto_model.goto_functions .update ();
1149
1149
}
1150
1150
1151
- if (cmdline.isset (" synthesize-loop-invariants" ))
1152
- {
1153
- log .warning () << " Loop invariant synthesizer is still work in progress. "
1154
- " It only generates TRUE as invariants."
1155
- << messaget::eom;
1156
-
1157
- // Synthesize loop invariants and annotate them into `goto_model`
1158
- enumerative_loop_invariant_synthesizert synthesizer (goto_model, log );
1159
- annotate_invariants (synthesizer.synthesize_all (), goto_model, log );
1160
- }
1161
1151
1162
1152
bool use_dfcc = cmdline.isset (FLAG_DFCC);
1163
1153
if (use_dfcc)
@@ -1432,6 +1422,33 @@ void goto_instrument_parse_optionst::instrument_goto_program()
1432
1422
goto_check_c (options, goto_model, ui_message_handler);
1433
1423
transform_assertions_assumptions (options, goto_model);
1434
1424
1425
+ if (cmdline.isset (FLAG_SYNTHESIZE_LOOP_INVARIANTS))
1426
+ {
1427
+ if (cmdline.isset (FLAG_LOOP_CONTRACTS))
1428
+ {
1429
+ throw invalid_command_line_argument_exceptiont (
1430
+ " Incompatible options detected" ,
1431
+ " --" FLAG_SYNTHESIZE_LOOP_INVARIANTS " and --" FLAG_LOOP_CONTRACTS,
1432
+ " Use either --" FLAG_SYNTHESIZE_LOOP_INVARIANTS
1433
+ " or --" FLAG_LOOP_CONTRACTS);
1434
+ }
1435
+
1436
+ log .warning () << " Loop invariant synthesizer is still work in progress. "
1437
+ " It only generates TRUE as invariants."
1438
+ << messaget::eom;
1439
+
1440
+ // Synthesize loop invariants and annotate them into `goto_model`
1441
+ enumerative_loop_invariant_synthesizert synthesizer (goto_model, log );
1442
+ annotate_invariants (synthesizer.synthesize_all (), goto_model);
1443
+
1444
+ // Apply loop contracts.
1445
+ std::set<std::string> to_exclude_from_nondet_static (
1446
+ cmdline.get_values (" nondet-static-exclude" ).begin (),
1447
+ cmdline.get_values (" nondet-static-exclude" ).end ());
1448
+ code_contractst contracts (goto_model, log );
1449
+ contracts.apply_loop_contracts (to_exclude_from_nondet_static);
1450
+ }
1451
+
1435
1452
// check for uninitalized local variables
1436
1453
if (cmdline.isset (" uninitialized-check" ))
1437
1454
{
0 commit comments