[PATCH] Powerpc, fix vla-optimized-out.exp test

Carl Love cel@us.ibm.com
Mon Mar 28 15:34:12 GMT 2022


GDB maintainers, Will:

I updated the commit log and comments to say variable a not vla per
Will's comments.  The updated patch is below.

As mentioned earlier, I don't think it is appropriate to change the
test so variable a is not optimized out.  The test does expect that it
will be optimized out.

                        Carl 

-------------------------------------------------------------------

GDB maintainers:

The vla-optimized-out.exp test has a check to print the size of
variable a.  The test expects the size to be available even though the
use of the variable has been optimized out.  This is true on Intel. 
However, on Powerpc both the use and the size of the variable are
optimized out.

This patch adds to the test to check for the size or optimized out. The
change fixes the test failure on Powerpc.

The patch has been tested on a Power 10 system and on and Intel 64-bit
system.  No regressions were seen.

Please let me know if this patch is acceptable for gdb mainline. 
Thanks.

                    Carl Love
-------------------------------------------------
Powerpc, fix vla-optimized-out.exp test

The size of the variable a is not optimized out on Intel inspite of the
use of the variable use being optimized out.

On Powerpc, the use of variable a and the size of variable a are both
optimized out.

The output on Powerpc is:

p sizeof (a)
$2 = <optimized out>
(gdb) FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla

This patch changes the gdb_test to check for the size of vla being
available or optimized out.  In either case, the test now passes.
---
 gdb/testsuite/gdb.base/vla-optimized-out.exp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/vla-optimized-out.exp b/gdb/testsuite/gdb.base/vla-optimized-out.exp
index b16142ee329..0a25788cb34 100644
--- a/gdb/testsuite/gdb.base/vla-optimized-out.exp
+++ b/gdb/testsuite/gdb.base/vla-optimized-out.exp
@@ -40,8 +40,10 @@ proc vla_optimized_out {exe_suffix options} {
 	" = <optimized out>" \
 	"printed optimized out vla"
 
+    # On Intel the variable use of variable a is optimized out but the size is
+    # available.  On Powerpc, the variable and the size of a are optimized out.
     gdb_test "p sizeof (a)" \
-	" = ($sizeof_result)" \
+	"( = ($sizeof_result)| = <optimized out>)" \
 	"printed size of optimized out vla"
 
     # At lower optimisation levels, the upper bound of the array is
-- 
2.31.1




More information about the Gdb-patches mailing list