fix gdb.base/access-mem-running.exp for clang testing
authorBruno Larsen <blarsen@redhat.com>
Wed, 20 Jul 2022 19:44:32 +0000 (16:44 -0300)
committerBruno Larsen <blarsen@redhat.com>
Mon, 12 Sep 2022 12:08:44 +0000 (14:08 +0200)
Clang was optimizing global_var away because it was not being used
anywhere. this commit fixes that by adding the attribute used it.

gdb/testsuite/gdb.base/access-mem-running.c

index 6335f1bf1997649f4e2d105a247accf1c9928d42..cff6f0da820fdb94c3180d7e7fafff781fa7724f 100644 (file)
@@ -19,7 +19,7 @@
 
 static unsigned int global_counter = 1;
 
-static volatile unsigned int global_var = 123;
+static volatile unsigned int __attribute__((used)) global_var = 123;
 
 static void
 maybe_stop_here ()