Skip to content

Fix Java object factory recursion set #824

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
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
9 changes: 2 additions & 7 deletions src/java_bytecode/java_object_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,8 @@ void java_object_factoryt::gen_nondet_init(
{
const struct_typet &struct_type=to_struct_type(subtype);
const irep_idt struct_tag=struct_type.get_tag();
// set to null if found in recursion set and not a sub-type
if(recursion_set.find(struct_tag)!=recursion_set.end() &&
struct_tag==class_identifier)
// If this is a recursive type of some kind, set null.
if(!recursion_set.insert(struct_tag).second)
{
if(update_in_place==NO_UPDATE_IN_PLACE)
set_null(expr, pointer_type);
Expand Down Expand Up @@ -403,9 +402,6 @@ void java_object_factoryt::gen_nondet_init(
if(!is_sub)
class_identifier=struct_tag;

recursion_set.insert(struct_tag);
assert(!recursion_set.empty());

for(const auto &component : components)
{
const typet &component_type=component.type();
Expand Down Expand Up @@ -460,7 +456,6 @@ void java_object_factoryt::gen_nondet_init(
substruct_in_place);
}
}
recursion_set.erase(struct_tag);
}
else
{
Expand Down