Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BUG: Attempt to fix sparc segfault (gh-2668)

  • Loading branch information...
commit e0dd41c0a7a4ec75f6f00dc6ef33f67964ea14b3 1 parent c97f405
@mwiebe mwiebe authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 numpy/core/src/multiarray/dtype_transfer.c
View
14 numpy/core/src/multiarray/dtype_transfer.c
@@ -3582,6 +3582,13 @@ PyArray_GetDTypeTransferFunction(int aligned,
PyArray_ISNBO(dst_dtype->byteorder)) {
if (PyArray_EquivTypenums(src_type_num, dst_type_num)) {
+ /*
+ * For complex numbers, the alignment is smaller than the
+ * type size, so we turn off the aligned flag then.
+ */
+ if (src_dtype->kind == 'c' || dst_dtype->kind == 'c') {
+ aligned = 0;
+ }
*out_stransfer = PyArray_GetStridedCopyFn(aligned,
src_stride, dst_stride,
src_itemsize);
@@ -3678,6 +3685,13 @@ PyArray_GetDTypeTransferFunction(int aligned,
/* This is a straight copy */
if (src_itemsize == 1 || PyArray_ISNBO(src_dtype->byteorder) ==
PyArray_ISNBO(dst_dtype->byteorder)) {
+ /*
+ * For complex numbers, the alignment is smaller than the
+ * type size, so we turn off the aligned flag then.
+ */
+ if (src_dtype->kind == 'c' || dst_dtype->kind == 'c') {
+ aligned = 0;
+ }
*out_stransfer = PyArray_GetStridedCopyFn(aligned,
src_stride, dst_stride,
src_itemsize);
Please sign in to comment.
Something went wrong with that request. Please try again.