Skip to content

Fix allow-null initialization logic for class models #2346

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
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
17 changes: 7 additions & 10 deletions jbmc/src/java_bytecode/java_entry_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,14 @@ static void java_static_lifetime_init(
}
else if(sym.value.is_nil() && sym.type!=empty_typet())
{
bool allow_null=!assume_init_pointers_not_null;
if(allow_null)
{
irep_idt nameid=sym.symbol_expr().get_identifier();
if(allow_null && is_java_string_literal_id(nameid))
allow_null=false;
if(allow_null && is_non_null_library_global(nameid))
allow_null = false;
}
const bool is_class_model =
has_suffix(id2string(sym.name), "@class_model");
const bool not_allow_null = is_java_string_literal_id(sym.name) ||
is_non_null_library_global(sym.name) ||
assume_init_pointers_not_null;

object_factory_parameterst parameters = object_factory_parameters;
if(!allow_null)
if(not_allow_null && !is_class_model)
parameters.max_nonnull_tree_depth = 1;

gen_nondet_init(
Expand Down