Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add second test for issue 7344 where one of the reduction variables i…
…s only incremented in the if part of an if/else.
  • Loading branch information
DrTodd13 committed Aug 31, 2021
commit eeac2fa39107da8c8457e5003445785bcddaccd0
14 changes: 14 additions & 0 deletions numba/tests/test_parfors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1574,6 +1574,20 @@ def test_impl(A, cond):
return s
self.check(test_impl, np.ones(10), np.ones(10).astype('bool'))

def test_if_not_else_reduction(self):
# issue #7344
def test_impl(A, cond):
s = 1
t = 10
for i in prange(A.shape[0]):
if cond[i]:
s += 1
t += 1
else:
s += 2
return s + t
self.check(test_impl, np.ones(10), np.ones(10).astype('bool'))

def test_two_d_array_reduction_reuse(self):
def test_impl(n):
shp = (13, 17)
Expand Down