Skip to content

Commit 9354403

Browse files
committed
JBMC: enable unwinding assertions by default
We changed the default for CBMC in 9b52a38 in the interest of producing sound verification results. We should do the same for JBMC.
1 parent ae7d311 commit 9354403

File tree

12 files changed

+21
-16
lines changed

12 files changed

+21
-16
lines changed

doc/man/jbmc.1

+3
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ remove assignments unrelated to property
349349
generate unwinding assertions (cannot be
350350
used with \fB\-\-cover\fR)
351351
.TP
352+
\fB\-\-no\-unwinding\-assertions\fR
353+
do not generate unwinding assertions
354+
.TP
352355
\fB\-\-partial\-loops\fR
353356
permit paths with partial loops
354357
.TP

jbmc/regression/jbmc-strings/StringConcat/test_string_nondet_array.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
Test
3-
--function Test.fromNonDetArray --depth 10000 --unwind 5 --throw-runtime-exceptions --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar ../../../lib/java-models-library/target/cprover-api.jar` --trace
3+
--function Test.fromNonDetArray --depth 10000 --unwind 5 --no-unwinding-assertions --throw-runtime-exceptions --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar ../../../lib/java-models-library/target/cprover-api.jar` --trace
44
^EXIT=10$
55
^SIGNAL=0$
66
^VERIFICATION FAILED

jbmc/regression/jbmc-strings/StringIndexOf/test_thorough.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
Test
3-
--function Test.check --unwind 10 --max-nondet-string-length 10 --java-assume-inputs-non-null
3+
--function Test.check --unwind 10 --no-unwinding-assertions --max-nondet-string-length 10 --java-assume-inputs-non-null
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$

jbmc/regression/jbmc-strings/VerifStringLastIndexOf/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
THOROUGH
22
Test
3-
--function Test.check --max-nondet-string-length 50 --unwind 50 --java-assume-inputs-non-null --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar ../../../lib/java-models-library/target/cprover-api.jar` --sat-solver cadical
3+
--function Test.check --max-nondet-string-length 50 --unwind 50 --no-unwinding-assertions --java-assume-inputs-non-null --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar ../../../lib/java-models-library/target/cprover-api.jar` --sat-solver cadical
44
VERIFICATION SUCCESSFUL
55
^EXIT=0$
66
^SIGNAL=0$

jbmc/regression/jbmc/NondetArray2/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
NondetArray2
3-
--function NondetArray2.main --unwind 5
3+
--function NondetArray2.main --unwind 5 --no-unwinding-assertions
44
^VERIFICATION SUCCESSFUL$
55
^EXIT=0$
66
^SIGNAL=0$

jbmc/regression/jbmc/NondetArray3/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
NondetArray3
3-
--function NondetArray3.main --unwind 5
3+
--function NondetArray3.main --unwind 5 --no-unwinding-assertions
44
^VERIFICATION SUCCESSFUL$
55
^EXIT=0$
66
^SIGNAL=0$

jbmc/regression/jbmc/dynamic-multi-dimensional-array/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
TestClass
3-
--function TestClass.f --unwind 2
3+
--function TestClass.f --unwind 2 --no-unwinding-assertions
44
^EXIT=0$
55
^SIGNAL=0$
66
--

jbmc/regression/jbmc/enum/test_enum1.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
Enum1
3-
--java-unwind-enum-static --unwind 3
3+
--java-unwind-enum-static --unwind 3 --no-unwinding-assertions
44
^VERIFICATION SUCCESSFUL$
55
^EXIT=0$
66
^SIGNAL=0$

jbmc/regression/jbmc/nondet_propagation1/andNot_Pass.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
andNot_Pass
3-
--depth 1600 --java-unwind-enum-static --java-max-vla-length 48 --unwind 4 --max-nondet-string-length 100 --function andNot_Pass.main
3+
--depth 1600 --java-unwind-enum-static --java-max-vla-length 48 --unwind 4 --no-unwinding-assertions --max-nondet-string-length 100 --function andNot_Pass.main
44
^\[java::andNot_Pass\.main:\(\[Ljava/lang/String;\)V.assertion\.3\] line 40 assertion at file andNot_Pass\.java line 40 function java::andNot_Pass.main:\(\[Ljava/lang/String;\)V bytecode-index 52: FAILURE$
55
^\*\* 1 of \d+ failed
66
VERIFICATION FAILED

jbmc/regression/jbmc/nondet_propagation1/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
andNot_Bug
3-
--depth 1600 --java-unwind-enum-static --java-max-vla-length 48 --unwind 4 --max-nondet-string-length 100 --function andNot_Bug.main
3+
--depth 1600 --java-unwind-enum-static --java-max-vla-length 48 --unwind 4 --no-unwinding-assertions --max-nondet-string-length 100 --function andNot_Bug.main
44
^EXIT=0$
55
^SIGNAL=0$
66
--

jbmc/regression/jbmc/output-options/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE symex-driven-lazy-loading-expected-failure
22
Main
3-
--verbosity 10 --unwind 2 --disable-uncaught-exception-check --throw-assertion-error
3+
--verbosity 10 --unwind 2 --no-unwinding-assertions --disable-uncaught-exception-check --throw-assertion-error
44
^VERIFICATION SUCCESSFUL$
55
^EXIT=0$
66
^SIGNAL=0$

jbmc/src/jbmc/jbmc_parse_options.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,16 @@ void jbmc_parse_optionst::get_command_line_options(optionst &options)
205205
}
206206
}
207207

208+
// generate unwinding assertions
209+
options.set_option(
210+
"unwinding-assertions",
211+
cmdline.isset("unwinding-assertions") ||
212+
!cmdline.isset("no-unwinding-assertions"));
213+
208214
if(cmdline.isset("unwind"))
209215
{
210216
options.set_option("unwind", cmdline.get_value("unwind"));
211-
if(!cmdline.isset("unwinding-assertions"))
217+
if(!options.get_bool_option("unwinding-assertions"))
212218
{
213219
log.warning() << "**** WARNING: Use --unwinding-assertions to obtain "
214220
"sound verification results"
@@ -229,7 +235,7 @@ void jbmc_parse_optionst::get_command_line_options(optionst &options)
229235
{
230236
options.set_option(
231237
"unwindset", cmdline.get_comma_separated_values("unwindset"));
232-
if(!cmdline.isset("unwinding-assertions"))
238+
if(!options.get_bool_option("unwinding-assertions"))
233239
{
234240
log.warning() << "**** WARNING: Use --unwinding-assertions to obtain "
235241
"sound verification results"
@@ -258,10 +264,6 @@ void jbmc_parse_optionst::get_command_line_options(optionst &options)
258264
if(cmdline.isset("no-assumptions"))
259265
options.set_option("assumptions", false);
260266

261-
// generate unwinding assertions
262-
if(cmdline.isset("unwinding-assertions"))
263-
options.set_option("unwinding-assertions", true);
264-
265267
// generate unwinding assumptions otherwise
266268
if(cmdline.isset("partial-loops"))
267269
{

0 commit comments

Comments
 (0)