Skip to content

Commit

Permalink
don't read uninitialized values in OMP prefix_sum
Browse files Browse the repository at this point in the history
  • Loading branch information
upsj committed Mar 21, 2023
1 parent 069b7b5 commit 440c994
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion omp/components/prefix_sum_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void prefix_sum_nonnegative(std::shared_ptr<const OmpExecutor> exec,

IndexType partial_sum{0};
for (size_type i = startidx; i < endidx; ++i) {
auto nnz = counts[i];
auto nnz = i < num_entries - 1 ? counts[i] : IndexType{};
counts[i] = partial_sum;
if (max - partial_sum < nnz) {
overflow = true;
Expand Down

0 comments on commit 440c994

Please sign in to comment.