]> granicus.if.org Git - gc/commitdiff
Workaround TSan data race report in check_fl_marks
authorIvan Maidanski <ivmai@mail.ru>
Thu, 7 Dec 2017 21:52:50 +0000 (00:52 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 7 Dec 2017 21:52:50 +0000 (00:52 +0300)
* alloc.c [GC_ASSERTIONS && THREAD_LOCAL_ALLOC
&& AO_HAVE_load_acquire_read] (GC_check_fl_marks): Skip the whole check
if THREAD_SANITIZER; add comment.

alloc.c

diff --git a/alloc.c b/alloc.c
index 825d515235e539d93dbf27325b984d011f6b9e05..c8e2ef2bed7d0f9ba300aebc18475b96e6144d50 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -835,7 +835,10 @@ GC_INNER void GC_set_fl_marks(ptr_t q)
   /* (*pfreelist) are set.  Check skipped if points to a special value. */
   void GC_check_fl_marks(void **pfreelist)
   {
-#   ifdef AO_HAVE_load_acquire_read
+    /* TODO: There is a data race with GC_FAST_MALLOC_GRANS (which does */
+    /* not do atomic updates to the free-list).  The race seems to be   */
+    /* harmless, and for now we just skip this check in case of TSan.   */
+#   if defined(AO_HAVE_load_acquire_read) && !defined(THREAD_SANITIZER)
       AO_t *list = (AO_t *)AO_load_acquire_read((AO_t *)pfreelist);
                 /* Atomic operations are used because the world is running. */
       AO_t *prev;