Skip to content

Commit c1a43b2

Browse files
committed
Removal of original most-recent-alloc record from the valuest map.
This also fixes one of the the xfail benchmarks.
1 parent 1e52b2b commit c1a43b2

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

regression/LVSA/recent_alloc_clear_from_callees/Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static void should_be_most_recent_A_3() {
105105
output = e;
106106
}
107107

108-
public static void should_be_and_should_not_be_most_recent_A_4() {
108+
public static void should_be_most_recent_A_4() {
109109
A d = getA(getData());
110110
A e = getA(getData());
111111
output = e.data;

regression/LVSA/recent_alloc_clear_from_callees/test_recent_alloc_clear_from_callees.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,17 @@ def test_should_be_most_recent_A_3(tmpdir):
142142
value_set_expectation.check_contains_dynamic_object(1, True)
143143

144144

145-
@pytest.mark.xfail
146-
def test_should_be_and_should_not_be_most_recent_A_4(tmpdir):
145+
def test_should_be_most_recent_A_4(tmpdir):
147146
"""
148147
[11] Checks whether 'is_most_recent_allocation' flag is cleared when
149148
receiving DOs from callees.
150149
"""
151150
with utils.working_dir(_get_this_file_dir()):
152151
os.system("javac Test.java")
153-
lvsa_driver = driver.LvsaDriver(tmpdir, _get_folder_name()).with_test_function('should_be_and_should_not_be_most_recent_A_4')
152+
lvsa_driver = driver.LvsaDriver(tmpdir, _get_folder_name()).with_test_function('should_be_most_recent_A_4')
154153
lvsa_expectation = lvsa_driver.run()
155154
value_set_expectation = lvsa_expectation.get_value_set_for_output()
156155
value_set_expectation.check_contains_dynamic_object(1, True)
157-
value_set_expectation.check_contains_dynamic_object(0, False)
158156

159157

160158
def test_should_not_be_most_recent_caller_1(tmpdir):

src/pointer-analysis/local_value_set_analysis.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,10 @@ void local_value_set_analysist::transform_function_stub(
319319
const typet &dynamic_type=
320320
static_cast<const typet &>(rhs_expr.find(ID_C_cxx_alloc_type));
321321

322-
// Iterates over the domain's entries and when we find the current
323-
// most-recent-allocation dynamic-object, add its object-map
324-
// to its correspondent any-allocation dynamic-object's object-map
325-
for(auto &value : valuesets.values)
322+
std::vector<local_value_sett::valuest::iterator> to_remove;
323+
for(auto it=valuesets.values.begin(); it!=valuesets.values.end(); ++it)
326324
{
325+
auto &value=*it;
327326
local_value_sett::entryt &entry=value.second;
328327

329328
if(entry.identifier==name_most_recent)
@@ -333,8 +332,11 @@ void local_value_set_analysist::transform_function_stub(
333332
dynamic_type,
334333
ns);
335334
valuesets.make_union(entry_any_allocation.object_map, entry.object_map);
335+
to_remove.push_back(it);
336336
}
337337
}
338+
for(auto it : to_remove)
339+
valuesets.values.erase(it);
338340
}
339341

340342
valuesets.insert(rhs_map, rhs_expr);

0 commit comments

Comments
 (0)