]> granicus.if.org Git - gc/commitdiff
Eliminate TSan warning about A.dummy in gctest
authorIvan Maidanski <ivmai@mail.ru>
Thu, 2 Nov 2017 21:58:18 +0000 (00:58 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 15 Dec 2017 21:29:52 +0000 (00:29 +0300)
* tests/test.c (reverse_test_inner): Move A.dummy=17 to
set_print_procs().
* tests/test.c (set_print_procs): Add comment.

tests/test.c

index 828a3cd7dc8b73261460fd04f373dde216ffcf72..7a45884ff684767d397a137a56baecf96669ad95 100644 (file)
@@ -712,7 +712,6 @@ void *GC_CALLBACK reverse_test_inner(void *data)
 #     define BIG 4500
 #   endif
 
-    A.dummy = 17;
     a_set(ints(1, 49));
     b = ints(1, 50);
     c = ints(1, BIG);
@@ -1217,7 +1216,7 @@ void typed_test(void)
 }
 
 #ifdef DBG_HDRS_ALL
-# define set_print_procs() (void)0
+# define set_print_procs() (void)(A.dummy = 17)
 #else
   int fail_count = 0;
 
@@ -1228,6 +1227,8 @@ void typed_test(void)
 
   void set_print_procs(void)
   {
+    /* Set these global variables just once to avoid TSan false positives. */
+    A.dummy = 17;
     GC_is_valid_displacement_print_proc = fail_proc1;
     GC_is_visible_print_proc = fail_proc1;
   }