8000 TST: Add a test for bug gh-2668 · certik/numpy@d676f1f · GitHub
[go: up one dir, main page]

Skip to content

Commit d676f1f

Browse files
mwiebecertik
authored andcommitted
TST: Add a test for bug numpygh-2668
This is the test attached to the bug from Matthew Brett. I tried to make a simpler test, but it didn't repro the problem.
1 parent c25886d commit d676f1f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

numpy/core/tests/test_regression.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,5 +1771,22 @@ def test_searchsorted_wrong_dtype(self):
17711771
a = np.recarray((2, ), dtype)
17721772
assert_raises(TypeError, np.searchsorted, a, 1)
17731773

1774+
def test_complex64_alignment(self):
1775+
# Issue gh-2668 (trac 2076), segfault on sparc due to misalignment
1776+
dtt = np.complex64
1777+
arr = np.arange(10, dtype=dtt)
1778+
# 2D array
1779+
arr2 = np.reshape(arr, (2, 5))
1780+
# Fortran write followed by (C or F) read caused bus error
1781+
data_str = arr2.tostring('F')
1782+
data_back = np.ndarray(arr2.shape,
1783+
arr2.dtype,
1784+
buffer=data_str,
1785+
order='F')
1786+
assert_array_equal(arr2, data_back)
1787+
1788+
1789+
1790+
17741791
if __name__ == "__main__":
17751792
run_module_suite()

0 commit comments

Comments
 (0)
0