Skip to content

Commit ad28e97

Browse files
committed
Remove infinity_exprt
This removes `infinity_exprt` together with all its uses, where were all about array size. Any such arrays were replaced by arrays of the maximum viable size.
1 parent d2b4455 commit ad28e97

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+97
-204
lines changed

jbmc/src/java_bytecode/java_string_library_preprocess.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ refined_string_exprt java_string_library_preprocesst::replace_char_array(
450450
get_length(array, symbol_table), char_array, refined_string_type);
451451

452452
const dereference_exprt inf_array(
453-
char_array, array_typet(java_char_type(), infinity_exprt(java_int_type())));
453+
char_array, array_typet(java_char_type(), java_int_type().largest_expr()));
454454

455455
add_pointer_to_array_association(
456456
string_expr.content(), inf_array, symbol_table, loc, function_id, code);
@@ -619,7 +619,7 @@ exprt make_nondet_infinite_char_array(
619619
code_blockt &code)
620620
{
621621
const array_typet array_type(
622-
java_char_type(), infinity_exprt(java_int_type()));
622+
java_char_type(), java_int_type().largest_expr());
623623
const symbolt data_sym = fresh_java_symbol(
624624
pointer_type(array_type),
625625
"nondet_infinite_array_pointer",

jbmc/unit/solvers/strings/string_constraint_instantiation/instantiate_not_contains.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,21 @@ class tt
4040
{
4141
return java_char_type();
4242
}
43-
typet length_type() const
43+
signedbv_typet length_type() const
4444
{
4545
return java_int_type();
4646
}
4747
array_typet array_type() const
4848
{
49-
return array_typet(char_type(), infinity_exprt(length_type()));
49+
return array_typet(char_type(), length_type().largest_expr());
5050
}
5151
refined_string_typet string_type() const
5252
{
5353
return refined_string_typet(length_type(), pointer_type(char_type()));
5454
}
5555
array_typet witness_type() const
5656
{
57-
return array_typet(length_type(), infinity_exprt(length_type()));
57+
return array_typet(length_type(), length_type().largest_expr());
5858
}
5959
};
6060

jbmc/unit/solvers/strings/string_refinement/dependency_graph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ Author: Diffblue Ltd.
2121
#include <java_bytecode/java_bytecode_language.h>
2222
#endif
2323

24-
typet length_type()
24+
signedbv_typet length_type()
2525
{
2626
return signedbv_typet(32);
2727
}
2828

2929
/// Make a struct with a pointer content and an integer length
3030
struct_exprt make_string_argument(std::string name)
3131
{
32-
const array_typet char_array(char_type(), infinity_exprt(length_type()));
32+
const array_typet char_array(char_type(), length_type().largest_expr());
3333
struct_typet type(
3434
{{"length", length_type()}, {"content", pointer_type(char_array)}});
3535

regression/cbmc-concurrency/thread_chain_cbmc1/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
typedef unsigned long thread_id_t;
1919

2020
// Internal unbounded array indexed by local thread identifiers
21-
__CPROVER_bool __CPROVER_threads_exited[__CPROVER_constant_infinity_uint];
21+
__CPROVER_bool __CPROVER_threads_exited
22+
[(__CPROVER_size_t)1 << (sizeof(__CPROVER_size_t) * 8 - 2)];
2223

2324
// A thread_chain is like a chain of threads `f, g, ...` where `f`
2425
// must terminate before `g` can start to run, and so forth.

regression/cbmc-concurrency/thread_chain_cbmc2/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
typedef unsigned long thread_id_t;
1919

2020
// Internal unbounded array indexed by local thread identifiers
21-
__CPROVER_bool __CPROVER_threads_exited[__CPROVER_constant_infinity_uint];
21+
__CPROVER_bool __CPROVER_threads_exited
22+
[(__CPROVER_size_t)1 << (sizeof(__CPROVER_size_t) * 8 - 2)];
2223

2324
// A thread_chain is like a chain of threads `f, g, ...` where `f`
2425
// must terminate before `g` can start to run, and so forth.

regression/cbmc-cpp/Vector1/lib/list

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,10 @@ namespace std {
372372
#ifdef VERS1
373373
unsigned _version;
374374
#elif defined VERS2
375-
unsigned _version[__CPROVER::constant_infinity_uint];
375+
unsigned _version[(__CPROVER_size_t)1 << (sizeof(__CPROVER_size_t) * 8 - 2)];
376376
#endif
377377

378-
T _data[__CPROVER::constant_infinity_uint];
378+
T _data[(__CPROVER_size_t)1 << (sizeof(__CPROVER_size_t) * 8 - 2)];
379379
};
380380

381381
}

regression/cbmc-cpp/Vector1/lib/vector

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,10 @@ namespace std {
416416
#ifdef VERS1
417417
unsigned _version;
418418
#elif defined VERS2
419-
unsigned _version[__CPROVER::constant_infinity_uint];
419+
unsigned _version[(__CPROVER_size_t)1 << (sizeof(__CPROVER_size_t) * 8 - 2)];
420420
#endif
421421

422-
T _data[__CPROVER::constant_infinity_uint];
422+
T _data[(__CPROVER_size_t)1 << (sizeof(__CPROVER_size_t) * 8 - 2)];
423423
};
424424

425425
}

regression/cbmc-cpp/initialization5/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include <cassert>
2-
int a[__CPROVER::constant_infinity_uint];
2+
int a[(__CPROVER_size_t)1 << (sizeof(__CPROVER_size_t) * 8 - 2)];
33

44
struct A
55
{
6-
int i[__CPROVER::constant_infinity_uint];
6+
int i[(__CPROVER_size_t)1 << (sizeof(__CPROVER_size_t) * 8 - 2)];
77
};
88

99
A o;

regression/cbmc/Unbounded_Array5/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
int mem[__CPROVER_constant_infinity_uint];
1+
int mem[(__CPROVER_size_t)1 << (sizeof(__CPROVER_size_t) * 8 - 2)];
22

33
int main()
44
{

regression/cbmc/array_of_bool_as_bitvec/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <stdlib.h>
44

55
__CPROVER_bool w[8];
6-
__CPROVER_bool v[__CPROVER_constant_infinity_uint];
6+
__CPROVER_bool v[(__CPROVER_size_t)1 << (sizeof(__CPROVER_size_t) * 8 - 2)];
77

88
void main()
99
{

0 commit comments

Comments
 (0)