summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2022-05-08 19:21:24 -0600
committerGitHub <noreply@github.com>2022-05-08 19:21:24 -0600
commitb0b912f7c0f349304824db543f2a59f091ca590c (patch)
treee2d1dfd00aaac788fb7618da7d484d4a3a5c2d12 /numpy
parent37cb0f8463345648add0e1e98fd146c966146981 (diff)
parent3257ab09fa557625f7f38ba96d9d8e6ba5470822 (diff)
downloadnumpy-b0b912f7c0f349304824db543f2a59f091ca590c.tar.gz
Merge pull request #21467 from seberg/mark-no-sanitize-on-npy-memchr
MAINT: Mark `npy_memchr` with `no_sanitize("alignment")` on clang
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/common.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/common.h b/numpy/core/src/multiarray/common.h
index 85fd3aab1..ed022e4f8 100644
--- a/numpy/core/src/multiarray/common.h
+++ b/numpy/core/src/multiarray/common.h
@@ -248,6 +248,15 @@ npy_uint_alignment(int itemsize)
* compared to memchr it returns one stride past end instead of NULL if needle
* is not found.
*/
+#ifdef __clang__
+ /*
+ * The code below currently makes use of !NPY_ALIGNMENT_REQUIRED, which
+ * should be OK but causes the clang sanitizer to warn. It may make
+ * sense to modify the code to avoid this "unaligned" access but
+ * it would be good to carefully check the performance changes.
+ */
+ __attribute__((no_sanitize("alignment")))
+#endif
static NPY_INLINE char *
npy_memchr(char * haystack, char needle,
npy_intp stride, npy_intp size, npy_intp * psubloopsize, int invert)