[OB PATCH] Prevent false passes in gdb.base/vla-optimized-out.exp
Gary Benson
gbenson@redhat.com
Tue Nov 10 16:42:00 GMT 2020
The "vla_optimized_out" procedure in gdb.base/vla-optimized-out.exp
accepts a "sizeof_result" argument which is substituted into the
regular expression used to check the result of printing the sizeof
a VLA. The -O3 test variants, however, pass a regular expression
fragment as that argument, which expands into a regular expression
that matches any result with a "6" in it. This commit wraps the
substitution with parentheses to prevent these false matches.
gdb/testsuite/ChangeLog:
* gdb.base/vla-optimized-out.exp (p sizeof (a)): Wrap supplied
regexp fragment in parentheses to prevent false matching.
---
gdb/testsuite/ChangeLog | 5 +++++
gdb/testsuite/gdb.base/vla-optimized-out.exp | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.base/vla-optimized-out.exp b/gdb/testsuite/gdb.base/vla-optimized-out.exp
index 66d1a13..203a82d 100644
--- a/gdb/testsuite/gdb.base/vla-optimized-out.exp
+++ b/gdb/testsuite/gdb.base/vla-optimized-out.exp
@@ -42,7 +42,7 @@ proc vla_optimized_out {exe_suffix options} {
"printed optimized out vla"
gdb_test "p sizeof (a)" \
- " = $sizeof_result" \
+ " = ($sizeof_result)" \
"printed size of optimized out vla"
# At lower optimisation levels, the upper bound of the array is
--
1.8.3.1
More information about the Gdb-patches
mailing list