Skip to content

Commit 0ff98e8

Browse files
author
Daniel Kroening
authored
Merge pull request #823 from owen-jones-diffblue/bugfix/java-parameter-declarations-master
Assign variables for all parameters
2 parents bd4221c + c34be32 commit 0ff98e8

File tree

1 file changed

+25
-34
lines changed

1 file changed

+25
-34
lines changed

src/java_bytecode/java_object_factory.cpp

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,13 @@ void java_object_factoryt::gen_nondet_init(
356356
}
357357
else
358358
{
359-
side_effect_expr_nondett se=side_effect_expr_nondett(type);
359+
exprt rhs=type.id()==ID_c_bool?
360+
get_nondet_bool(type):
361+
side_effect_expr_nondett(type);
362+
code_assignt assign(expr, rhs);
363+
assign.add_source_location()=loc;
360364

361-
code_assignt code(expr, se);
362-
code.add_source_location()=loc;
363-
init_code.copy_to_operands(code);
365+
init_code.copy_to_operands(assign);
364366
}
365367
}
366368

@@ -517,36 +519,25 @@ exprt object_factory(
517519
size_t max_nondet_array_length,
518520
const source_locationt &loc)
519521
{
520-
if(type.id()==ID_pointer)
521-
{
522-
symbolt &aux_symbol=new_tmp_symbol(
523-
symbol_table,
524-
loc,
525-
type);
526-
aux_symbol.is_static_lifetime=true;
522+
symbolt &aux_symbol=new_tmp_symbol(
523+
symbol_table,
524+
loc,
525+
type);
526+
aux_symbol.is_static_lifetime=true;
527527

528-
exprt object=aux_symbol.symbol_expr();
528+
exprt object=aux_symbol.symbol_expr();
529529

530-
java_object_factoryt state(
531-
init_code,
532-
!allow_null,
533-
max_nondet_array_length,
534-
symbol_table);
535-
state.gen_nondet_init(
536-
object,
537-
false,
538-
"",
539-
loc,
540-
false);
541-
542-
return object;
543-
}
544-
else if(type.id()==ID_c_bool)
545-
{
546-
// We force this to 0 and 1 and won't consider
547-
// other values.
548-
return get_nondet_bool(type);
549-
}
550-
else
551-
return side_effect_expr_nondett(type);
530+
java_object_factoryt state(
531+
init_code,
532+
!allow_null,
533+
max_nondet_array_length,
534+
symbol_table);
535+
state.gen_nondet_init(
536+
object,
537+
false,
538+
"",
539+
loc,
540+
false);
541+
542+
return object;
552543
}

0 commit comments

Comments
 (0)