Skip to content

Commit 93bd022

Browse files
committed
Permit keeping trivially-true assertions
In some settings it is desirable to obtain a report of all properties being checked, including those that are trivially true. There used to be an option "all-claims", then renamed to "retain-trivial", but the latter was never made available in command-line front-ends. The option is now renamed to retain-trivial-checks, and made available in all front-ends.
1 parent c2d5ed5 commit 93bd022

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

regression/cbmc/bounds_check2/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
int main()
2+
{
3+
int A[2];
4+
int x = A[1];
5+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
main.c
3+
--bounds-check --retain-trivial-checks
4+
^Generated \d+ VCC\(s\), 0 remaining after simplification$
5+
^\[main.array_bounds.1\] line 4 array 'A' lower bound in A\[\(signed (long (long )?)?int\)1\]: SUCCESS$
6+
^VERIFICATION SUCCESSFUL$
7+
^EXIT=0$
8+
^SIGNAL=0$
9+
--
10+
^warning: ignoring
11+
^Generated 0 VCC\(s\), 0 remaining after simplification$

src/analyses/goto_check.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class goto_checkt
7070
_options.get_bool_option("float-overflow-check");
7171
enable_simplify=_options.get_bool_option("simplify");
7272
enable_nan_check=_options.get_bool_option("nan-check");
73-
retain_trivial=_options.get_bool_option("retain-trivial");
73+
retain_trivial = _options.get_bool_option("retain-trivial-checks");
7474
enable_assert_to_assume=_options.get_bool_option("assert-to-assume");
7575
enable_assertions=_options.get_bool_option("assertions");
7676
enable_built_in_assertions=_options.get_bool_option("built-in-assertions");

src/analyses/goto_check.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ void goto_check(
3939
"overflow-check)" \
4040
"(pointer-overflow-check)(conversion-check)(undefined-shift-check)" \
4141
"(float-overflow-check)(nan-check)(no-built-in-assertions)" \
42-
"(pointer-primitive-check)"
42+
"(pointer-primitive-check)" \
43+
"(retain-trivial-checks)"
4344

4445
// clang-format off
4546
#define HELP_GOTO_CHECK \
@@ -54,9 +55,10 @@ void goto_check(
5455
" --undefined-shift-check check shift greater than bit-width\n" \
5556
" --float-overflow-check check floating-point for +/-Inf\n" \
5657
" --nan-check check floating-point for NaN\n" \
57-
" --no-built-in-assertions ignore assertions in built-in library\n" \
5858
" --enum-range-check checks that all enum type expressions have values in the enum range\n" /* NOLINT(whitespace/line_length) */ \
59-
" --pointer-primitive-check checks that all pointers in pointer primitives are valid or null\n" /* NOLINT(whitespace/line_length) */
59+
" --pointer-primitive-check checks that all pointers in pointer primitives are valid or null\n" /* NOLINT(whitespace/line_length) */ \
60+
" --no-built-in-assertions ignore assertions in built-in library\n" \
61+
" --retain-trivial-checks include checks that are trivially true\n" \
6062

6163
#define PARSE_OPTIONS_GOTO_CHECK(cmdline, options) \
6264
options.set_option("bounds-check", cmdline.isset("bounds-check")); \
@@ -72,7 +74,10 @@ void goto_check(
7274
options.set_option("float-overflow-check", cmdline.isset("float-overflow-check")); /* NOLINT(whitespace/line_length) */ \
7375
options.set_option("nan-check", cmdline.isset("nan-check")); \
7476
options.set_option("built-in-assertions", !cmdline.isset("no-built-in-assertions")); /* NOLINT(whitespace/line_length) */ \
75-
options.set_option("pointer-primitive-check", cmdline.isset("pointer-primitive-check")) /* NOLINT(whitespace/line_length) */
77+
options.set_option("pointer-primitive-check", cmdline.isset("pointer-primitive-check")); /* NOLINT(whitespace/line_length) */ \
78+
options.set_option("retain-trivial-checks", \
79+
cmdline.isset("retain-trivial-checks")); \
80+
(void)0
7681
// clang-format on
7782

7883
#endif // CPROVER_ANALYSES_GOTO_CHECK_H

0 commit comments

Comments
 (0)