summaryrefslogtreecommitdiff
path: root/typd_mlc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-05-06 23:03:29 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-05-06 23:03:29 +0300
commit247e7354f3361e5cfe9ea9dd420fbdeac801efaa (patch)
treeda4ff0cd6ec3740ec711b563d6a7a18b4282b37d /typd_mlc.c
parentf8e6e7d8fb2fdadb58fc33b6035053abb0e8957c (diff)
downloadbdwgc-247e7354f3361e5cfe9ea9dd420fbdeac801efaa.tar.gz
Workaround TSan FP about race between generic_malloc and array_mark_proc
* typd_mlc.c (get_complex_descr): New static function (defined with GC_ATTR_NO_SANITIZE_THREAD attribute). * typd_mlc.c (GC_array_mark_proc): Use get_complex_descr() instead of direct access of addr[nwords-1].
Diffstat (limited to 'typd_mlc.c')
-rw-r--r--typd_mlc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/typd_mlc.c b/typd_mlc.c
index 614e4ad6..3167ede6 100644
--- a/typd_mlc.c
+++ b/typd_mlc.c
@@ -450,6 +450,12 @@ STATIC mse * GC_push_complex_descriptor(word *addr, complex_descriptor *d,
}
}
+GC_ATTR_NO_SANITIZE_THREAD
+static complex_descriptor *get_complex_descr(word *addr, word nwords)
+{
+ return (complex_descriptor *)addr[nwords - 1];
+}
+
STATIC mse * GC_array_mark_proc(word * addr, mse * mark_stack_ptr,
mse * mark_stack_limit,
word env GC_ATTR_UNUSED)
@@ -457,7 +463,7 @@ STATIC mse * GC_array_mark_proc(word * addr, mse * mark_stack_ptr,
hdr * hhdr = HDR(addr);
word sz = hhdr -> hb_sz;
word nwords = BYTES_TO_WORDS(sz);
- complex_descriptor * descr = (complex_descriptor *)(addr[nwords-1]);
+ complex_descriptor *descr = get_complex_descr(addr, nwords);
mse * orig_mark_stack_ptr = mark_stack_ptr;
mse * new_mark_stack_ptr;