Skip to content

Commit

Permalink
fix uninitialized memory in conversions to Dense
Browse files Browse the repository at this point in the history
  • Loading branch information
upsj committed Feb 1, 2022
1 parent 114866b commit 690a45a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions core/matrix/coo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ template <typename ValueType, typename IndexType>
void Coo<ValueType, IndexType>::convert_to(Dense<ValueType>* result) const
{
auto exec = this->get_executor();
result->resize(this->get_size());
result->fill(zero<ValueType>());
exec->run(coo::make_fill_in_dense(
this, make_temporary_output_clone(exec, result).get()));
auto tmp_result = make_temporary_output_clone(exec, result);
tmp_result->resize(this->get_size());
tmp_result->fill(zero<ValueType>());
exec->run(coo::make_fill_in_dense(this, tmp_result.get()));
}


Expand Down
8 changes: 4 additions & 4 deletions core/matrix/csr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@ template <typename ValueType, typename IndexType>
void Csr<ValueType, IndexType>::convert_to(Dense<ValueType>* result) const
{
auto exec = this->get_executor();
result->resize(this->get_size());
result->fill(zero<ValueType>());
exec->run(csr::make_fill_in_dense(
this, make_temporary_output_clone(exec, result).get()));
auto tmp_result = make_temporary_output_clone(exec, result);
tmp_result->resize(this->get_size());
tmp_result->fill(zero<ValueType>());
exec->run(csr::make_fill_in_dense(this, tmp_result.get()));
}


Expand Down
8 changes: 4 additions & 4 deletions core/matrix/ell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ template <typename ValueType, typename IndexType>
void Ell<ValueType, IndexType>::convert_to(Dense<ValueType>* result) const
{
auto exec = this->get_executor();
result->resize(this->get_size());
result->fill(zero<ValueType>());
exec->run(ell::make_fill_in_dense(
this, make_temporary_output_clone(exec, result).get()));
auto tmp_result = make_temporary_output_clone(exec, result);
tmp_result->resize(this->get_size());
tmp_result->fill(zero<ValueType>());
exec->run(ell::make_fill_in_dense(this, tmp_result.get()));
}


Expand Down
8 changes: 4 additions & 4 deletions core/matrix/fbcsr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ void Fbcsr<ValueType, IndexType>::convert_to(
Dense<ValueType>* const result) const
{
auto exec = this->get_executor();
result->resize(this->get_size());
result->fill(zero<ValueType>());
exec->run(fbcsr::make_fill_in_dense(
this, make_temporary_output_clone(exec, result).get()));
auto tmp_result = make_temporary_output_clone(exec, result);
tmp_result->resize(this->get_size());
tmp_result->fill(zero<ValueType>());
exec->run(fbcsr::make_fill_in_dense(this, tmp_result.get()));
}


Expand Down
8 changes: 4 additions & 4 deletions core/matrix/sellp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ template <typename ValueType, typename IndexType>
void Sellp<ValueType, IndexType>::convert_to(Dense<ValueType>* result) const
{
auto exec = this->get_executor();
result->resize(this->get_size());
result->fill(zero<ValueType>());
exec->run(sellp::make_fill_in_dense(
this, make_temporary_output_clone(exec, result).get()));
auto tmp_result = make_temporary_output_clone(exec, result);
tmp_result->resize(this->get_size());
tmp_result->fill(zero<ValueType>());
exec->run(sellp::make_fill_in_dense(this, tmp_result.get()));
}


Expand Down
8 changes: 4 additions & 4 deletions core/matrix/sparsity_csr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ void SparsityCsr<ValueType, IndexType>::convert_to(
Dense<ValueType>* result) const
{
auto exec = this->get_executor();
auto tmp = make_temporary_output_clone(exec, result);
tmp->resize(this->get_size());
tmp->fill(zero<ValueType>());
exec->run(sparsity_csr::make_fill_in_dense(this, tmp.get()));
auto tmp_result = make_temporary_output_clone(exec, result);
tmp_result->resize(this->get_size());
tmp_result->fill(zero<ValueType>());
exec->run(sparsity_csr::make_fill_in_dense(this, tmp_result.get()));
}


Expand Down

0 comments on commit 690a45a

Please sign in to comment.