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 via email to