Skip to content

Commit

Permalink
Merge pull request #21475 from charris/backport-21467
Browse files Browse the repository at this point in the history
MAINT: Mark `npy_memchr` with `no_sanitize("alignment")` on clang
  • Loading branch information
charris committed May 9, 2022
2 parents 159438b + a8f4e78 commit cac0887
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions numpy/core/src/multiarray/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cac0887

Please sign in to comment.