summaryrefslogtreecommitdiff
path: root/Python/pymath.c
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2018-11-12 12:07:14 -0800
committerGitHub <noreply@github.com>2018-11-12 12:07:14 -0800
commit1584a0081500d35dc93ff88e5836df35faf3e3e2 (patch)
tree986afdd14c17e1678359e28513bd13452152c59f /Python/pymath.c
parenta9655b7f71b8976c369160ef362d0e706cfcd8c9 (diff)
downloadcpython-git-1584a0081500d35dc93ff88e5836df35faf3e3e2.tar.gz
bpo-35214: Initial clang MemorySanitizer support (GH-10479)
Adds configure flags for msan and ubsan builds to make it easier to enable. These also encode the detail that address sanitizer and memory sanitizer should disable pymalloc. Define MEMORY_SANITIZER when appropriate at build time and adds workarounds to existing code to mark things as initialized where the sanitizer is otherwise unable to determine that. This lets our build succeed under the memory sanitizer. not all tests pass without sanitizer failures yet but we're in pretty good shape after this.
Diffstat (limited to 'Python/pymath.c')
-rw-r--r--Python/pymath.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/pymath.c b/Python/pymath.c
index 6799d200ca..c1606bd6d1 100644
--- a/Python/pymath.c
+++ b/Python/pymath.c
@@ -17,7 +17,9 @@ double _Py_force_double(double x)
/* inline assembly for getting and setting the 387 FPU control word on
gcc/x86 */
-
+#ifdef MEMORY_SANITIZER
+__attribute__((no_sanitize_memory))
+#endif
unsigned short _Py_get_387controlword(void) {
unsigned short cw;
__asm__ __volatile__ ("fnstcw %0" : "=m" (cw));