Skip to content

Commit 9b34cdb

Browse files
Merge pull request diffblue#1564 from owen-jones-diffblue/bugfix/object-numbering-references
Fix references to object_numbering's data
2 parents 52d4326 + ede0e8c commit 9b34cdb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/pointer-analysis/value_set.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,9 @@ void value_sett::get_value_set_rec(
466466
it1!=object_map.end();
467467
it1++)
468468
{
469-
const exprt &object=object_numbering[it1->first];
469+
/// Do not take a reference to object_numbering's storage as we may call
470+
/// object_numbering.number(), which may reallocate it.
471+
const exprt object=object_numbering[it1->first];
470472
get_value_set_rec(object, dest, suffix, original_type, ns);
471473
}
472474
}
@@ -489,7 +491,9 @@ void value_sett::get_value_set_rec(
489491
it!=object_map.end();
490492
it++)
491493
{
492-
const exprt &object=object_numbering[it->first];
494+
/// Do not take a reference to object_numbering's storage as we may call
495+
/// object_numbering.number(), which may reallocate it.
496+
const exprt object=object_numbering[it->first];
493497
get_value_set_rec(object, dest, suffix, original_type, ns);
494498
}
495499
}
@@ -1348,7 +1352,9 @@ void value_sett::assign_rec(
13481352
it!=reference_set.read().end();
13491353
it++)
13501354
{
1351-
const exprt &object=object_numbering[it->first];
1355+
/// Do not take a reference to object_numbering's storage as we may call
1356+
/// object_numbering.number(), which may reallocate it.
1357+
const exprt object=object_numbering[it->first];
13521358

13531359
if(object.id()!=ID_unknown)
13541360
assign_rec(object, values_rhs, suffix, ns, add_to_sets);

0 commit comments

Comments
 (0)