1 // Test that custom memmove implementations instrumented by HWASan do not cause
4 // RUN: %clang_hwasan %s -o %t
8 #include <sanitizer/hwasan_interface.h>
11 void *memmove(void *Dest
, const void *Src
, size_t N
) {
12 char *Tmp
= (char *)malloc(N
);
13 char *D
= (char *)Dest
;
14 const char *S
= (const char *)Src
;
16 for (size_t I
= 0; I
< N
; ++I
)
18 for (size_t I
= 0; I
< N
; ++I
)
26 __hwasan_enable_allocator_tagging();
28 const size_t BufSize
= 64;
29 char *Buf
= (char *)malloc(BufSize
);
31 for (size_t I
= 0; I
< BufSize
; ++I
)
33 memmove(Buf
+ BufSize
/ 2, Buf
, BufSize
/ 2);
34 for (size_t I
= 0; I
< BufSize
; ++I
)
35 assert(Buf
[I
] == I
% (BufSize
/ 2));