File tree Expand file tree Collapse file tree 14 files changed +151
-50
lines changed
pragma_cprover_enable_all Expand file tree Collapse file tree 14 files changed +151
-50
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,10 @@ enable array bounds checks
6262check shift greater than bit\- width
6363.TP
6464\fB \-\- div \- by \- zero \- check \fR
65- enable division by zero checks
65+ enable division by zero checks for integer division
66+ .TP
67+ \fB \-\- float \- div \- by \- zero \- check \fR
68+ enable division by zero checks for floating-point division
6669.TP
6770\fB \-\- pointer \- primitive \- check \fR
6871checks that all pointers in pointer primitives are valid or null
Original file line number Diff line number Diff line change @@ -521,7 +521,10 @@ Enable memory cleanup checks: assert that all dynamically allocated memory is
521521explicitly freed before terminating the program.
522522.TP
523523\fB \-\- div \- by \- zero \- check \fR
524- enable division by zero checks
524+ enable division by zero checks for integer division
525+ .TP
526+ \fB \-\- float \- div \- by \- zero \- check \fR
527+ enable division by zero checks for floating-point division
525528.TP
526529\fB \-\- signed \- overflow \- check \fR
527530enable signed arithmetic over\- and underflow checks
Original file line number Diff line number Diff line change @@ -52,7 +52,10 @@ Enable memory cleanup checks: assert that all dynamically allocated memory is
5252explicitly freed before terminating the program.
5353.TP
5454\fB \-\- div \- by \- zero \- check \fR
55- enable division by zero checks
55+ enable division by zero checks for integer division
56+ .TP
57+ \fB \-\- float \- div \- by \- zero \- check \fR
58+ enable division by zero checks for floating-point division
5659.TP
5760\fB \-\- signed \- overflow \- check \fR
5861enable signed arithmetic over\- and underflow checks
Original file line number Diff line number Diff line change @@ -192,7 +192,10 @@ Enable memory cleanup checks: assert that all dynamically allocated memory is
192192explicitly freed before terminating the program.
193193.TP
194194\fB \-\- div \- by \- zero \- check \fR
195- enable division by zero checks
195+ enable division by zero checks for integer division
196+ .TP
197+ \fB \-\- float \- div \- by \- zero \- check \fR
198+ enable division by zero checks for floating-point division
196199.TP
197200\fB \-\- signed \- overflow \- check \fR
198201enable signed arithmetic over\- and underflow checks
Original file line number Diff line number Diff line change 1+ #include <assert.h>
2+ #include <math.h>
3+
4+ int main ()
5+ {
6+ assert (1.0 / 2 == 0.5 );
7+ assert (1.0 / 0 == INFINITY );
8+ assert (-1.0 / 0 == - INFINITY );
9+ assert (isnan (NAN / 0 ));
10+ assert (1.0 / INFINITY == 0 );
11+ assert (isnan (INFINITY / INFINITY ));
12+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ floating_point_division1.c
3+
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ ^VERIFICATION SUCCESSFUL$
7+ --
8+ ^warning: ignoring
Original file line number Diff line number Diff line change 1+ #include <assert.h>
2+ #include <math.h>
3+
4+ double nondet_double ();
5+
6+ int main ()
7+ {
8+ double y = nondet_double ();
9+
10+ if (y == 0 )
11+ {
12+ // we expect to catch this with --float-div-by-zero-check
13+ double x = 1.0 / y ;
14+ }
15+ }
Original file line number Diff line number Diff line change 1+ CORE no-new-smt
2+ floating_point_division2.c
3+ --float-div-by-zero-check
4+ ^EXIT=10$
5+ ^SIGNAL=0$
6+ ^\[main\.float-division-by-zero\.1\] line \d+ floating-point division by zero in 1\.0 / y: FAILURE$
7+ ^VERIFICATION FAILED$
8+ --
9+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ int main()
1515#pragma CPROVER check push
1616#pragma CPROVER check disable "bounds"
1717#pragma CPROVER check disable "pointer"
18- #pragma CPROVER check disable "div-by-zero"
18+ #pragma CPROVER check disable "float- div-by-zero"
1919#pragma CPROVER check disable "enum-range"
2020#pragma CPROVER check disable "signed-overflow"
2121#pragma CPROVER check disable "unsigned-overflow"
@@ -52,7 +52,7 @@ int main()
5252#pragma CPROVER check push
5353#pragma CPROVER check enable "bounds"
5454#pragma CPROVER check enable "pointer"
55- #pragma CPROVER check enable "div-by-zero"
55+ #pragma CPROVER check enable "float- div-by-zero"
5656#pragma CPROVER check enable "enum-range"
5757#pragma CPROVER check enable "signed-overflow"
5858#pragma CPROVER check enable "unsigned-overflow"
Original file line number Diff line number Diff line change 55^\[main\.pointer_primitives\.\d+\] line 77 pointer outside object bounds in R_OK\(q, \(unsigned (long (long )?)?int\)1\): FAILURE$
66^\[main\.pointer_arithmetic\.\d+\] line 78 pointer arithmetic: pointer outside object bounds in p \+ (\(signed int\))?2000000000000(l|ll): FAILURE
77^\[main\.NaN\.\d+\] line 84 NaN on / in x / den: FAILURE
8- ^\[main\.division-by-zero\.\d+\] line 84 division by zero in x / den: FAILURE
8+ ^\[main\.float- division-by-zero\.\d+\] line 84 floating-point division by zero in x / den: FAILURE
99^\[main\.overflow\.\d+\] line 84 arithmetic overflow on floating-point division in x / den: FAILURE
1010^\[main\.enum-range-check\.\d+\] line 85 enum range check in \(ABC\)10: FAILURE
1111^\[main\.overflow\.\d+\] line 86 arithmetic overflow on signed (to unsigned )?type conversion in \(char\)\(\(signed int\)i \+ 1\): FAILURE
1818^\[main\.pointer_primitives\.\d+\] line 40 pointer outside object bounds in R_OK\(q, \(unsigned (long (long )?)?int\)1\): FAILURE$
1919^\[main\.pointer_arithmetic\.\d+\] line 41 pointer arithmetic: pointer outside object bounds in p \+ .*2000000000000(l|ll): FAILURE
2020^\[main\.NaN\.\d+\] line 47 NaN on / in x / den: FAILURE
21- ^\[main\.division-by-zero\.\d+\] line 47 division by zero in x / den: FAILURE
21+ ^\[main\.float- division-by-zero\.\d+\] line 47 floating-point division by zero in x / den: FAILURE
2222^\[main\.overflow\.\d+\] line 47 arithmetic overflow on floating-point division in x / den: FAILURE
2323^\[main\.enum-range-check\.\d+\] line 48 enum range check in \(ABC\)10: FAILURE
2424^\[main\.overflow\.\d+\] line 49 arithmetic overflow on signed type conversion in \(char\)\(signed int\)i \+ 1\): FAILURE
You can’t perform that action at this time.
0 commit comments