diff --git a/core/factorization/elimination_forest.cpp b/core/factorization/elimination_forest.cpp index 4e731ab854f..ef1e9659f2f 100644 --- a/core/factorization/elimination_forest.cpp +++ b/core/factorization/elimination_forest.cpp @@ -62,7 +62,8 @@ void compute_elim_forest_children_impl(const IndexType* parent, IndexType size, // we count the same again, this time shifted by 1 => exclusive prefix sum for (IndexType i = 0; i < size; i++) { const auto p = parent[i]; - child[child_ptr[p + 1]++] = i; + child[child_ptr[p + 1]] = i; + child_ptr[p + 1]++; } } @@ -98,7 +99,9 @@ void compute_elim_forest_postorder_lvl_impl( postorder_idx++; } else { // otherwise go to the next child node - cur_node = child[first_child + current_child[cur_node]++]; + const auto old_node = cur_node; + cur_node = child[first_child + current_child[old_node]]; + current_child[old_node]++; level_idx++; } }