Skip to content

Fix small bugs in string support related to Object.getClass #1021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/java_bytecode/java_string_library_preprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,8 @@ codet java_string_library_preprocesst::make_object_get_class_code(
ID_cprover_string_literal_func,
{class_identifier},
symbol_table));
exprt string_expr_sym=fresh_string_expr_symbol(loc, symbol_table, code);
code.add(code_assignt(string_expr_sym, string_expr));

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

// string1 = (String*) string_expr
pointer_typet string_ptr_type(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ string_exprt string_constraint_generatort::add_axioms_for_substring(
string_constraintt a4(idx,
res.length(),
equal_exprt(res[idx],
str[plus_exprt_with_overflow_check(start, idx)]));
str[plus_exprt(start, idx)]));
axioms.push_back(a4);
return res;
}
Expand Down