diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 0164558d07d..23a41d4bd7c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-08-30 Andrew Burgess + + * gdb.base/funcargs.c (use_a): New function. + (recurse): Call use_a. + 2018-08-29 Keith Seitz * gdb.compile/compile-cplus-anonymous.cc: New file. diff --git a/gdb/testsuite/gdb.base/funcargs.c b/gdb/testsuite/gdb.base/funcargs.c index 600792f0a7e..d5ff19218c6 100644 --- a/gdb/testsuite/gdb.base/funcargs.c +++ b/gdb/testsuite/gdb.base/funcargs.c @@ -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 ()