We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 410f130 commit 0177c1cCopy full SHA for 0177c1c
libc/src/__support/macros/sanitizer.h
@@ -47,9 +47,16 @@
47
// Functions to unpoison memory
48
//-----------------------------------------------------------------------------
49
50
-#ifdef LIBC_HAVE_MEMORY_SANITIZER
+#if defined(LIBC_HAVE_MEMORY_SANITIZER) && \
51
+ LIBC_HAS_BUILTIN(__builtin_constant_p)
52
+// Only perform MSAN unpoison in non-constexpr context.
53
#include <sanitizer/msan_interface.h>
-#define MSAN_UNPOISON(addr, size) __msan_unpoison(addr, size)
54
+#define MSAN_UNPOISON(addr, size) \
55
+ do { \
56
+ if (!__builtin_constant_p(*addr)) { \
57
+ __msan_unpoison(addr, size); \
58
+ } \
59
+ } while (0)
60
#else
61
#define MSAN_UNPOISON(ptr, size)
62
#endif
0 commit comments