Skip to content

Commit

Permalink
Merge pull request #22795 from charris/backport-22791
Browse files Browse the repository at this point in the history
BUG: Ensure arguments to ``npy_floatstatus_..._barrier()`` can be dereferenced
  • Loading branch information
charris committed Dec 14, 2022
2 parents 34653f9 + 0904c01 commit c484593
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions numpy/core/src/multiarray/array_assign_array.c
Expand Up @@ -130,7 +130,7 @@ raw_array_assign_array(int ndim, npy_intp const *shape,
}

if (!(flags & NPY_METH_NO_FLOATINGPOINT_ERRORS)) {
npy_clear_floatstatus_barrier(src_data);
npy_clear_floatstatus_barrier((char*)&src_data);
}
if (!(flags & NPY_METH_REQUIRES_PYAPI)) {
NPY_BEGIN_THREADS;
Expand All @@ -153,7 +153,7 @@ raw_array_assign_array(int ndim, npy_intp const *shape,
NPY_cast_info_xfree(&cast_info);

if (!(flags & NPY_METH_NO_FLOATINGPOINT_ERRORS)) {
int fpes = npy_get_floatstatus_barrier(src_data);
int fpes = npy_get_floatstatus_barrier((char*)&src_data);
if (fpes && PyUFunc_GiveFloatingpointErrors("cast", fpes) < 0) {
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/src/multiarray/ctors.c
Expand Up @@ -2832,7 +2832,7 @@ PyArray_CopyAsFlat(PyArrayObject *dst, PyArrayObject *src, NPY_ORDER order)
}

if (res == 0 && !(flags & NPY_METH_NO_FLOATINGPOINT_ERRORS)) {
int fpes = npy_get_floatstatus_barrier((char *)src_iter);
int fpes = npy_get_floatstatus_barrier((char *)&src_iter);
if (fpes && PyUFunc_GiveFloatingpointErrors("cast", fpes) < 0) {
return -1;
}
Expand Down

0 comments on commit c484593

Please sign in to comment.