Commit 9a56fae
committed
[gdb/build] Use -fno-hoist-adjacent-loads for gcc <= 13
When building gdb with gcc 12 and -fsanitize=threads while renabling
background dwarf reading by setting dwarf_synchronous to false, I run into:
...
(gdb) file amd64-watchpoint-downgrade
Reading symbols from amd64-watchpoint-downgrade...
(gdb) watch global_var
==================
WARNING: ThreadSanitizer: data race (pid=20124)
Read of size 8 at 0x7b80000500d8 by main thread:
#0 cooked_index_entry::full_name(obstack*, bool) const cooked-index.c:220
zephyrproject-rtos#1 cooked_index::get_main_name(obstack*, language*) const cooked-index.c:735
zephyrproject-rtos#2 cooked_index_worker::wait(cooked_state, bool) cooked-index.c:559
zephyrproject-rtos#3 cooked_index::wait(cooked_state, bool) cooked-index.c:631
zephyrproject-rtos#4 cooked_index_functions::wait(objfile*, bool) cooked-index.h:729
zephyrproject-rtos#5 cooked_index_functions::compute_main_name(objfile*) cooked-index.h:806
zephyrproject-rtos#6 objfile::compute_main_name() symfile-debug.c:461
zephyrproject-rtos#7 find_main_name symtab.c:6503
zephyrproject-rtos#8 main_language() symtab.c:6608
zephyrproject-rtos#9 set_initial_language_callback symfile.c:1634
zephyrproject-rtos#10 get_current_language() language.c:96
...
Previous write of size 8 at 0x7b80000500d8 by thread T1:
#0 cooked_index_shard::finalize(parent_map_map const*) \
dwarf2/cooked-index.c:409
zephyrproject-rtos#1 operator() cooked-index.c:663
...
...
SUMMARY: ThreadSanitizer: data race cooked-index.c:220 in \
cooked_index_entry::full_name(obstack*, bool) const
==================
Hardware watchpoint 1: global_var
(gdb) PASS: gdb.arch/amd64-watchpoint-downgrade.exp: watch global_var
...
This was also reported in PR31715.
This is due do gcc PR110799 [1], generating wrong code with
-fhoist-adjacent-loads, and causing a false positive for
-fsanitize=threads.
Work around the gcc PR by forcing -fno-hoist-adjacent-loads for gcc <= 13
and -fsanitize=threads.
Tested in that same configuration on x86_64-linux. Remaining ThreadSanitizer
problems are the ones reported in PR31626 (gdb.rust/dwindex.exp) and
PR32247 (gdb.trace/basic-libipa.exp).
PR gdb/31715
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31715
Tested-By: Bernd Edlinger <[email protected]>
Approved-By: Tom Tromey <[email protected]>
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=1107991 parent 3e0c29b commit 9a56fae
1 file changed
+7
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
23 | 30 | | |
24 | 31 | | |
25 | 32 | | |
| |||
0 commit comments