Skip to content

Commit 8a48f19

Browse files
authored
Address issues in algorithms identified by static analysis (#1340) (#1343)
1 parent cfd28cf commit 8a48f19

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

include/oneapi/dpl/pstl/hetero/algorithm_impl_hetero.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ __pattern_partial_sort_copy(_ExecutionPolicy&& __exec, _InIterator __first, _InI
15061506
template <typename _ExecutionPolicy, typename _Iterator, typename _Compare>
15071507
oneapi::dpl::__internal::__enable_if_hetero_execution_policy<_ExecutionPolicy>
15081508
__pattern_nth_element(_ExecutionPolicy&& __exec, _Iterator __first, _Iterator __nth, _Iterator __last, _Compare __comp,
1509-
/*vector*/ ::std::true_type, /*parallel*/ ::std::true_type) noexcept
1509+
/*vector*/ ::std::true_type, /*parallel*/ ::std::true_type)
15101510
{
15111511
if (__first == __last || __nth == __last)
15121512
return;

include/oneapi/dpl/pstl/hetero/numeric_ranges_impl_hetero.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ __pattern_transform_scan_base(_ExecutionPolicy&& __exec, _Range1&& __rng1, _Rang
9393
{
9494
if (__rng1.empty())
9595
return 0;
96+
oneapi::dpl::__internal::__difference_t<_Range2> __rng1_size = __rng1.size();
9697

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

124125
template <typename _ExecutionPolicy, typename _Range1, typename _Range2, typename _UnaryOperation, typename _Type,

0 commit comments

Comments
 (0)