diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-03-23 09:13:07 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-03-23 09:16:51 +0300 |
commit | b7f34cdda7100db253f0cf95169bef408a09ada1 (patch) | |
tree | da0d84f61c858ce9a40de3edaeaa90828cb4ae9b /mark.c | |
parent | 22dc290703d265d042728d27924bd8142726e1bc (diff) | |
download | bdwgc-b7f34cdda7100db253f0cf95169bef408a09ada1.tar.gz |
Use AO primitive in GC_noop1 instead of no_sanitize attribute
This eliminates GCC TSan report about data race in GC_noop1.
* mark.c [AO_HAVE_store && THREAD_SANITIZER] (GC_noop_sink): Use AO_t
type instead of word.
* mark.c (GC_noop1): Remove GC_ATTR_NO_SANITIZE_THREAD; refine comment.
* mark.c [AO_HAVE_store && THREAD_SANITIZER] (GC_noop1): Use AO_store.
Diffstat (limited to 'mark.c')
-rw-r--r-- | mark.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -48,13 +48,22 @@ void GC_noop6(word arg1 GC_ATTR_UNUSED, word arg2 GC_ATTR_UNUSED, # endif } -volatile word GC_noop_sink; +#if defined(AO_HAVE_store) && defined(THREAD_SANITIZER) + volatile AO_t GC_noop_sink; +#else + volatile word GC_noop_sink; +#endif -/* Single argument version, robust against whole program analysis. */ -GC_ATTR_NO_SANITIZE_THREAD +/* Make the argument appear live to compiler. This is similar */ +/* to GC_noop6(), but with a single argument. Robust against */ +/* whole program analysis. */ GC_API void GC_CALL GC_noop1(word x) { +# if defined(AO_HAVE_store) && defined(THREAD_SANITIZER) + AO_store(&GC_noop_sink, (AO_t)x); +# else GC_noop_sink = x; +# endif } /* Initialize GC_obj_kinds properly and standard free lists properly. */ |