Prevent false passes in gdb.base/vla-optimized-out.exp
authorGary Benson <gbenson@redhat.com>
Tue, 10 Nov 2020 16:40:40 +0000 (16:40 +0000)
committerGary Benson <gbenson@redhat.com>
Tue, 10 Nov 2020 16:40:40 +0000 (16:40 +0000)
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
gdb/testsuite/gdb.base/vla-optimized-out.exp

index 146fa1a086f144dfd75bd353d48409dcf913043f..608e48d8603345780aa948ef5c2da7fdaf6358cd 100644 (file)
@@ -1,3 +1,8 @@
+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)).
index 66d1a131d9559d0235ff70188fde2b3fe870539e..203a82d06e39280f366307ddff6225382818ae9f 100644 (file)
@@ -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
This page took 0.037173 seconds and 4 git commands to generate.