aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2020-11-10 16:40:40 +0000
committerGary Benson <gbenson@redhat.com>2020-11-10 16:40:40 +0000
commit83100a74a542bc2fa99387f518712ec0ef408a4b (patch)
tree71546b4935a0e35656a3d7a249fefb7af80dae0e
parent6ff174a7275512ce6f5c7a5496576a0531bd2c2f (diff)
downloadgdb-83100a74a542bc2fa99387f518712ec0ef408a4b.zip
gdb-83100a74a542bc2fa99387f518712ec0ef408a4b.tar.gz
gdb-83100a74a542bc2fa99387f518712ec0ef408a4b.tar.bz2
Prevent false passes in gdb.base/vla-optimized-out.exp
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.
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/vla-optimized-out.exp2
2 files changed, 6 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 146fa1a..608e48d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2020-11-10 Gary Benson <gbenson@redhat.com>
+ * gdb.base/vla-optimized-out.exp (p sizeof (a)): Wrap supplied
+ regexp fragment in parentheses to prevent false matching.
+
+2020-11-10 Gary Benson <gbenson@redhat.com>
+
* gdb.base/vla-optimized-out.c (f1): Add __attribute__ ((weak)).
2020-11-10 Gary Benson <gbenson@redhat.com>
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