Skip to content

Commit dcbda65

Browse files
author
Joel Allred
authored
Merge pull request #3827 from allredj/disable-loopless-init-for-bool
Skip simple nondet initialization for arrays of bool
2 parents 12bce17 + 0304c32 commit dcbda65

File tree

3 files changed

+4
-20
lines changed

3 files changed

+4
-20
lines changed

jbmc/regression/jbmc/NondetArrayPrimitive/NondetArrayPrimitive.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ void byteArray(byte[] array)
4949
}
5050
}
5151

52-
void boolArray(boolean[] array)
53-
{
54-
if (array != null && array.length > 1500 && array[1500] == true) {
55-
assert false;
56-
}
57-
}
58-
5952
void intArrayMulti(int[][] array)
6053
{
6154
if (array != null &&

jbmc/regression/jbmc/NondetArrayPrimitive/boolArray.desc

Lines changed: 0 additions & 12 deletions
This file was deleted.

jbmc/src/java_bytecode/java_object_factory.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ void java_object_factoryt::gen_nondet_array_init(
14241424
init_array_expr =
14251425
typecast_exprt(init_array_expr, pointer_type(element_type));
14261426

1427-
if(element_type.id() == ID_pointer)
1427+
if(element_type.id() == ID_pointer || element_type.id() == ID_c_bool)
14281428
{
14291429
// For arrays of non-primitive types, nondeterministically initialize each
14301430
// element of the array
@@ -1441,6 +1441,9 @@ void java_object_factoryt::gen_nondet_array_init(
14411441
else
14421442
{
14431443
// Arrays of primitive types can be initialized with a single instruction
1444+
// We don't do this for arrays of Booleans, because Bools are represented
1445+
// as bytes, so each cell must be initialized in a particular way (see
1446+
// gen_nondet_init).
14441447
array_primitive_init_code(
14451448
assignments,
14461449
init_array_expr,

0 commit comments

Comments
 (0)