Skip to content

Commit 70a9806

Browse files
author
Daniel Kroening
authored
Merge pull request #1021 from romainbrenguier/bugfix/object-get-class#272
Fix small bugs in string support related to Object.getClass
2 parents 05875e1 + 50be530 commit 70a9806

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/java_bytecode/java_string_library_preprocess.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -1223,6 +1223,8 @@ codet java_string_library_preprocesst::make_object_get_class_code(
12231223
ID_cprover_string_literal_func,
12241224
{class_identifier},
12251225
symbol_table));
1226+
exprt string_expr_sym=fresh_string_expr_symbol(loc, symbol_table, code);
1227+
code.add(code_assignt(string_expr_sym, string_expr));
12261228

12271229
// string_expr1 = substr(string_expr, 6)
12281230
// We do this to remove the "java::" prefix
@@ -1233,6 +1235,8 @@ codet java_string_library_preprocesst::make_object_get_class_code(
12331235
ID_cprover_string_substring_func,
12341236
{string_expr, from_integer(6, java_int_type())},
12351237
symbol_table));
1238+
exprt string_expr_sym1=fresh_string_expr_symbol(loc, symbol_table, code);
1239+
code.add(code_assignt(string_expr_sym1, string_expr1));
12361240

12371241
// string1 = (String*) string_expr
12381242
pointer_typet string_ptr_type(

src/solvers/refinement/string_constraint_generator_transformation.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ string_exprt string_constraint_generatort::add_axioms_for_substring(
122122
string_constraintt a4(idx,
123123
res.length(),
124124
equal_exprt(res[idx],
125-
str[plus_exprt_with_overflow_check(start, idx)]));
125+
str[plus_exprt(start, idx)]));
126126
axioms.push_back(a4);
127127
return res;
128128
}

0 commit comments

Comments
 (0)