@@ -450,6 +450,24 @@ ifdef APPLY_LOOP_CONTRACTS
450450 endif
451451endif
452452
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+
453471# Silence makefile output (eg, long litani commands) unless VERBOSE is set.
454472ifndef VERBOSE
455473 MAKEFLAGS := $(MAKEFLAGS ) -s
@@ -713,13 +731,13 @@ $(HARNESS_GOTO)0500.goto: $(HARNESS_GOTO)0400.goto
713731ifneq ($(strip $(USE_DYNAMIC_FRAMES ) ) ,)
714732 $(LITANI) add-job \
715733 --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 ) $^ $@' \
717735 --inputs $^ \
718736 --outputs $@ \
719737 --stdout-file $(LOGDIR)/unwind_loops-log.txt \
720738 --pipeline-name "$(PROOF_UID)" \
721739 --ci-stage build \
722- --description "$(PROOF_UID): unwinding all loops"
740+ --description $(UNWIND_0500_DESC)
723741else ifneq ($(strip $(CODE_CONTRACTS)),)
724742 $(LITANI) add-job \
725743 --command \
735753 --command 'cp $^ $@' \
736754 --inputs $^ \
737755 --outputs $@ \
738- --stdout-file $(LOGDIR)/linking-library-models -log.txt \
756+ --stdout-file $(LOGDIR)/unwind_loops -log.txt \
739757 --pipeline-name "$(PROOF_UID)" \
740758 --ci-stage build \
741759 --description "$(PROOF_UID): not unwinding loops"
@@ -794,7 +812,7 @@ ifdef CBMCFLAGS
794812 ifeq ($(strip $(CODE_CONTRACTS)),)
795813 CBMCFLAGS += $(CBMC_UNWINDSET ) $(CBMC_CPROVER_LIBRARY_UNWINDSET ) $(CBMC_DEFAULT_UNWIND ) $(CBMC_OPT_CONFIG_LIBRARY )
796814 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 )
798816 endif
799817endif
800818
0 commit comments