8000 BUG: Attempt to fix sparc segfault (gh-2668) · certik/numpy@c25886d · GitHub
[go: up one dir, main page]

Skip to conte 8000 nt

Commit c25886d

Browse files
mwiebecertik
authored andcommitted
BUG: Attempt to fix sparc segfault (numpygh-2668)
1 parent cb0ee58 commit c25886d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

numpy/core/src/multiarray/dtype_transfer.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3582,6 +3582,13 @@ PyArray_GetDTypeTransferFunction(int aligned,
35823582
PyArray_ISNBO(dst_dtype->byteorder)) {
35833583

35843584
if (PyArray_EquivTypenums(src_type_num, dst_type_num)) {
3585+
/*
3586+
* For complex numbers, the alignment is smaller than the
3587+
* type size, so we turn off the aligned flag then.
3588+
*/
3589+
if (src_dtype->kind == 'c' || dst_dtype->kind == 'c') {
3590+
aligned = 0;
3591+
}
35853592
*out_stransfer = PyArray_GetStridedCopyFn(aligned,
35863593
src_stride, dst_stride,
35873594
src_itemsize);
@@ -3678,6 +3685,13 @@ PyArray_GetDTypeTransferFunction(int aligned,
36783685
/* This is a straight copy */
36793686
if (src_itemsize == 1 || PyArray_ISNBO(src_dtype->byteorder) ==
36803687
PyArray_ISNBO(dst_dtype->byteorder)) {
3688+
/*
3689+
* For complex numbers, the alignment is smaller than the
3690+
* type size, so we turn off the aligned flag then.
3691+
*/
3692+
if (src_dtype->kind == 'c' || dst_dtype->kind == 'c') {
3693+
aligned = 0;
3694+
}
36813695
*out_stransfer = PyArray_GetStridedCopyFn(aligned,
36823696
src_stride, dst_stride,
36833697
src_itemsize);

0 commit comments

Comments
 (0)
0