From 379435351c807e5399ec3e9227d3019597ca2143 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 17 Oct 2023 14:32:26 -0600 Subject: Fix race in DWARF reader The recent change to record the DWARF language in the per-CU data yielded a race warning in my testing: ThreadSanitizer: data race ../../binutils-gdb/gdb/dwarf2/read.c:21779 in prepare_one_comp_unit This patch fixes the bug by applying the same style of fix that was done for the ordinary (gdb) language. I wonder if this code could be improved. Requiring an atomic for the language in particular seems unfortunate, as it is often consulted during index finalization. However, I haven't investigated this. Regression tested on x86-64 Fedora 38. Reviewed-by: Tom de Vries --- gdb/dwarf2/index-write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/dwarf2/index-write.c') diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c index bac4a6c..8c87f05 100644 --- a/gdb/dwarf2/index-write.c +++ b/gdb/dwarf2/index-write.c @@ -1205,7 +1205,7 @@ write_shortcuts_table (cooked_index *table, data_buf &shortcuts, if (main_info != nullptr) { - dw_lang = main_info->per_cu->dw_lang; + dw_lang = main_info->per_cu->dw_lang (); if (dw_lang != 0) { -- cgit v1.1