gdb.base/gcore.c (array_func): Add reference to static_array.
authorDoug Evans <dje@google.com>
Mon, 28 Sep 2015 20:27:28 +0000 (13:27 -0700)
committerDoug Evans <dje@google.com>
Mon, 28 Sep 2015 20:27:28 +0000 (13:27 -0700)
Otherwise clang will delete it: it's otherwise unused.

gdb/testsuite/ChangeLog:

* gdb.base/gcore.c (array_func): Add reference to static_array.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/gcore.c

index 7d52ba0252b735bdc7f725d15ac571e79474d703..344e633d842a69eb9c493785189fe3b9b2901a60 100644 (file)
@@ -1,3 +1,7 @@
+2015-09-28  Doug Evans  <dje@google.com>
+
+       * gdb.base/gcore.c (array_func): Add reference to static_array.
+
 2015-09-25  Simon Marchi  <simon.marchi@ericsson.com>
 
        * gdb.gdb/selftest.exp (do_steps_and_nexts): Adjust expected
index d6acc1f9b9c0a1f1b2a008855da0fd5b0382cccb..b6d8d54e5df06d2e03fe61d9a74ba375ed8236e6 100644 (file)
@@ -46,6 +46,8 @@ array_func ()
       un_initialized_array[i] = extern_array[i] + 8;
       local_array[i] = extern_array[i] + 12;
     }
+  /* Reference static_array so that clang doesn't discard it.  */
+  (void) static_array[0];
   terminal_func ();
 }