gdb: Ensure compiler doesn't optimise variable out in test
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / funcargs.c
index 600792f0a7ef95a0a7d618293e63fc5334d87615..d5ff19218c6a682cb940237bfc9da3a167d70b29 100644 (file)
@@ -424,6 +424,12 @@ void hitbottom ()
 {
 }
 
+void use_a (SVAL a)
+{
+  /* Trick the compiler into thinking A is important.  */
+  volatile SVAL dummy = a;
+}
+
 void recurse (SVAL a, int depth)
 {
   a.s = a.i = a.l = --depth;
@@ -431,6 +437,9 @@ void recurse (SVAL a, int depth)
     hitbottom ();
   else
     recurse (a, depth);
+
+  /* Ensure A is not discarded after the above calls.  */
+  use_a (a);
 }
 
 void test_struct_args ()
This page took 0.024386 seconds and 4 git commands to generate.