Skip to content

Commit

Permalink
Address issues in algorithms identified by static analysis (#1340) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
timmiesmith authored Jan 12, 2024
1 parent cfd28cf commit 8a48f19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/oneapi/dpl/pstl/hetero/algorithm_impl_hetero.h
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,7 @@ __pattern_partial_sort_copy(_ExecutionPolicy&& __exec, _InIterator __first, _InI
template <typename _ExecutionPolicy, typename _Iterator, typename _Compare>
oneapi::dpl::__internal::__enable_if_hetero_execution_policy<_ExecutionPolicy>
__pattern_nth_element(_ExecutionPolicy&& __exec, _Iterator __first, _Iterator __nth, _Iterator __last, _Compare __comp,
/*vector*/ ::std::true_type, /*parallel*/ ::std::true_type) noexcept
/*vector*/ ::std::true_type, /*parallel*/ ::std::true_type)
{
if (__first == __last || __nth == __last)
return;
Expand Down
3 changes: 2 additions & 1 deletion include/oneapi/dpl/pstl/hetero/numeric_ranges_impl_hetero.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ __pattern_transform_scan_base(_ExecutionPolicy&& __exec, _Range1&& __rng1, _Rang
{
if (__rng1.empty())
return 0;
oneapi::dpl::__internal::__difference_t<_Range2> __rng1_size = __rng1.size();

using _Type = typename _InitType::__value_type;
using _Assigner = unseq_backend::__scan_assigner;
Expand All @@ -118,7 +119,7 @@ __pattern_transform_scan_base(_ExecutionPolicy&& __exec, _Range1&& __rng1, _Rang
// global scan
unseq_backend::__global_scan_functor<_Inclusive, _BinaryOperation, _InitType>{__binary_op, __init})
.wait();
return __rng1.size();
return __rng1_size;
}

template <typename _ExecutionPolicy, typename _Range1, typename _Range2, typename _UnaryOperation, typename _Type,
Expand Down

0 comments on commit 8a48f19

Please sign in to comment.