[Bug testsuite/87958] New: scan-tree-dump-times vs. (foo|bar)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug testsuite/87958] New: scan-tree-dump-times vs. (foo|bar)

bergner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87958

            Bug ID: 87958
           Summary: scan-tree-dump-times vs. (foo|bar)
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: testsuite
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Anyone knows why (foo|bar) works for e.g. scan-tree-dump, but not for
scan-tree-dump-times?

/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-final { scan-tree-dump "call(123|456)fn" "optimized" } } */
/* { dg-final { scan-tree-dump-times "call(123|456)fn" 1 "optimized" } } */

void call123fn (void);

void
baz (void)
{
  call123fn ();
}

fails the scan-tree-dump-times test, but succeeds scan-tree-dump, even when
there is just one such call in the dump.  Surprisingly it succeeds if I change
the 1 to 2.  Are ()s in scan-tree-dump-times unsupported, or does one need to
adjust the count, so that it is not the number of times the whole string
matched, but number of times the whole string as well as any of those ()s
matched?  So e.g.
/* { dg-final { scan-tree-dump-times "b(a|b)z" 6 "optimized" } } */
succeeds on the testcase, because there are 3 baz strings and no bbz strings in
the dump.
Reply | Threaded
Open this post in threaded view
|

[Bug testsuite/87958] scan-tree-dump-times vs. (foo|bar)

bergner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87958

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #1 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
I guess we are supposed to use non-capturing groups, i.e. (?:123|456)
Reply | Threaded
Open this post in threaded view
|

[Bug testsuite/87958] scan-tree-dump-times vs. (foo|bar)

bergner at gcc dot gnu.org
In reply to this post by bergner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87958

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Ah, ok, thanks.  Perhaps we should just mention it in our scan-tree-dump-times
documentation and close then.