File tree 4 files changed +27
-19
lines changed
regression/cbmc/uniform_array1 4 files changed +27
-19
lines changed Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int A [] = {1 , 1 };
4
+ int i ;
5
+ __CPROVER_assert (i < 0 || i > 1 || A [i ] == 1 , "valid access into array of 1" );
6
+ __CPROVER_assert (A [i ] == 1 , "possible out-of-bounds access" );
7
+ return 0 ;
8
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION FAILED$
7
+ ^\*\* 1 of 2 failed
8
+ --
9
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -301,6 +301,7 @@ rm trace_options_json_extended/non-extended.desc
301
301
rm trace_show_code/test.desc
302
302
rm trace_show_function_calls/test.desc
303
303
rm uncaught_exceptions_analysis1/test.desc
304
+ rm uniform_array1/test.desc
304
305
rm union11/union_list.desc
305
306
rm union3/test.desc
306
307
rm union5/test.desc
Original file line number Diff line number Diff line change 8
8
9
9
#include " boolbv.h"
10
10
11
- #include < cassert >
11
+ #include < algorithm >
12
12
13
13
#include < util/arith_tools.h>
14
14
#include < util/cprover_prefix.h>
@@ -80,26 +80,16 @@ bvt boolbvt::convert_index(const index_exprt &expr)
80
80
// this rather than as a series of individual options.
81
81
#define UNIFORM_ARRAY_HACK
82
82
#ifdef UNIFORM_ARRAY_HACK
83
- bool is_uniform = false ;
83
+ bool is_uniform = array. id () == ID_array_of ;
84
84
85
- if (array.id ()==ID_array_of )
85
+ if (array.id () == ID_constant || array. id () == ID_array )
86
86
{
87
- is_uniform = true ;
88
- }
89
- else if (array.id ()==ID_constant || array.id ()==ID_array)
90
- {
91
- bool found_exception = false ;
92
- forall_expr (it, array.operands ())
93
- {
94
- if (*it != array.op0 ())
95
- {
96
- found_exception = true ;
97
- break ;
98
- }
99
- }
100
-
101
- if (!found_exception)
102
- is_uniform = true ;
87
+ is_uniform =
88
+ array.operands ().size () <= 1 ||
89
+ std::all_of (
90
+ ++array.operands ().begin (),
91
+ array.operands ().end (),
92
+ [&array](const exprt &expr) { return expr == array.op0 (); });
103
93
}
104
94
105
95
if (is_uniform && prop.has_set_to ())
You can’t perform that action at this time.
0 commit comments