@@ -450,6 +450,24 @@ ifdef APPLY_LOOP_CONTRACTS
450
450
endif
451
451
endif
452
452
453
+ # The default unwind should only be used in DFCC mode without loop contracts.
454
+ # When loop contracts are applied, we only unwind specified loops.
455
+ # If any loops remain after loop contracts have been applied, CBMC might try
456
+ # to unwind the program indefinetly, because we do not pass default unwind
457
+ # (i.e., --unwind 1) to CBMC when in DFCC mode.
458
+ # We must not use a default unwind command in DFCC mode, because contract instrumentation
459
+ # introduces loops encoding write set inclusion checks that must be dynamically unwound during
460
+ # symex.
461
+ ifneq ($(strip $(USE_DYNAMIC_FRAMES ) ) ,)
462
+ ifneq ($(strip $(APPLY_LOOP_CONTRACTS ) ) ,)
463
+ UNWIND_0500_FLAGS =$(CBMC_UNWINDSET ) $(CBMC_CPROVER_LIBRARY_UNWINDSET ) $(CBMC_FLAG_UNWINDING_ASSERTIONS )
464
+ UNWIND_0500_DESC ="$(PROOF_UID ) : unwinding specified subset of loops"
465
+ else
466
+ UNWIND_0500_FLAGS =$(CBMC_UNWINDSET ) $(CBMC_CPROVER_LIBRARY_UNWINDSET ) $(CBMC_DEFAULT_UNWIND ) $(CBMC_FLAG_UNWINDING_ASSERTIONS )
467
+ UNWIND_0500_DESC ="$(PROOF_UID ) : unwinding all loops"
468
+ endif
469
+ endif
470
+
453
471
# Silence makefile output (eg, long litani commands) unless VERBOSE is set.
454
472
ifndef VERBOSE
455
473
MAKEFLAGS := $(MAKEFLAGS ) -s
@@ -713,13 +731,13 @@ $(HARNESS_GOTO)0500.goto: $(HARNESS_GOTO)0400.goto
713
731
ifneq ($(strip $(USE_DYNAMIC_FRAMES ) ) ,)
714
732
$(LITANI) add-job \
715
733
--command \
716
- '$(GOTO_INSTRUMENT) $(CBMC_VERBOSITY) $(CBMC_UNWINDSET) $(CBMC_CPROVER_LIBRARY_UNWINDSET) $(CBMC_DEFAULT_UNWIND) $(CBMC_FLAG_UNWINDING_ASSERTIONS ) $^ $@' \
734
+ '$(GOTO_INSTRUMENT) $(CBMC_VERBOSITY) $(UNWIND_0500_FLAGS ) $^ $@' \
717
735
--inputs $^ \
718
736
--outputs $@ \
719
737
--stdout-file $(LOGDIR)/unwind_loops-log.txt \
720
738
--pipeline-name "$(PROOF_UID)" \
721
739
--ci-stage build \
722
- --description "$(PROOF_UID): unwinding all loops"
740
+ --description $(UNWIND_0500_DESC)
723
741
else ifneq ($(strip $(CODE_CONTRACTS)),)
724
742
$(LITANI) add-job \
725
743
--command \
735
753
--command 'cp $^ $@' \
736
754
--inputs $^ \
737
755
--outputs $@ \
738
- --stdout-file $(LOGDIR)/linking-library-models -log.txt \
756
+ --stdout-file $(LOGDIR)/unwind_loops -log.txt \
739
757
--pipeline-name "$(PROOF_UID)" \
740
758
--ci-stage build \
741
759
--description "$(PROOF_UID): not unwinding loops"
@@ -794,7 +812,7 @@ ifdef CBMCFLAGS
794
812
ifeq ($(strip $(CODE_CONTRACTS)),)
795
813
CBMCFLAGS += $(CBMC_UNWINDSET ) $(CBMC_CPROVER_LIBRARY_UNWINDSET ) $(CBMC_DEFAULT_UNWIND ) $(CBMC_OPT_CONFIG_LIBRARY )
796
814
else ifeq ($(strip $(USE_DYNAMIC_FRAMES)),)
797
- CBMCFLAGS += $(CBMC_CPROVER_LIBRARY_UNWINDSET ) $(CBMC_DEFAULT_UNWIND ) $( CBMC_OPT_CONFIG_LIBRARY )
815
+ CBMCFLAGS += $(CBMC_CPROVER_LIBRARY_UNWINDSET ) $(CBMC_OPT_CONFIG_LIBRARY )
798
816
endif
799
817
endif
800
818
0 commit comments