From 31c21e2c13d85793b525f74aa911eb28700ed89c Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Thu, 11 Apr 2024 13:43:52 +0200 Subject: [gdb/testsuite] Fix gdb.threads/access-mem-running-thread-exit.exp with clang When running test-case gdb.threads/access-mem-running-thread-exit.exp with clang, we run into: ... (gdb) print global_var = 555^M No symbol "global_var" in current context.^M (gdb) FAIL: gdb.threads/access-mem-running-thread-exit.exp: all-stop: \ access mem (write to global_var, inf=2, iter=1) ... The problem is that clang removes the unused variable. Fix this in the same way as done in commit b4f767131f7 ("Fix gdb.base/align-*.exp and Clang + LTO and AIX GCC"), by incrementing the variable. Tested on x86_64-linux with gcc and clang. --- gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c') diff --git a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c index 5902542..af05b13 100644 --- a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c +++ b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.c @@ -102,6 +102,8 @@ main (void) { int i; + global_var++; + for (i = 0; i < 4; i++) { struct thread_arg *p; -- cgit v1.1