summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-04-03 16:28:44 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-04-10 16:07:46 +0200
commit32fe9f005ce270a9f5a47b0fab1f8a718edbd1be (patch)
tree5d708f5aff2cbaf4d652c527b6061482fee65691
parent086fc0e972f1552de7092a2031fe8af1b54fe4cc (diff)
downloadjustbuild-32fe9f005ce270a9f5a47b0fab1f8a718edbd1be.tar.gz
bug fix in expresion, Union: propagate the disjointness property
To avoid too many intermediate results, we compute the union of a list in a divide and conquer fashion. Of course, for a disjoint union, the recursive calls on the lists of half the length have to be disjoint as well, i.e., the template parameter kDisjoint has to be passed on. Fix this. (cherry picked from commit 469a7190bee490344d147099c3511fc45e2aadf0)
-rw-r--r--CHANGELOG.md2
-rw-r--r--src/buildtool/build_engine/expression/evaluator.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 74a5450c..fbcc592e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,8 @@ Bug fixes on top of release `1.2.4`.
- Taintedness of "configure" targets is now propagated correctly.
- Missing atomic primitives added to the source code.
- A staging conflict in the test setup was fixed.
+- The expression `"disjoint_map_union"` did not verify disjointness
+ in all cases; this is fixed now.
## Release `1.2.4` (2023-12-19)
diff --git a/src/buildtool/build_engine/expression/evaluator.cpp b/src/buildtool/build_engine/expression/evaluator.cpp
index d2cee809..f75c643e 100644
--- a/src/buildtool/build_engine/expression/evaluator.cpp
+++ b/src/buildtool/build_engine/expression/evaluator.cpp
@@ -307,8 +307,8 @@ auto Union(Expression::list_t const& dicts, size_t from, size_t to)
return entry;
}
size_t mid = from + (to - from) / 2;
- auto left = Union(dicts, from, mid);
- auto right = Union(dicts, mid, to);
+ auto left = Union<kDisjoint>(dicts, from, mid);
+ auto right = Union<kDisjoint>(dicts, mid, to);
if (left->Map().empty()) {
return right;
}