https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122045

            Bug ID: 122045
           Summary: Problems with check-function-bodies
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: testsuite
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rearnsha at gcc dot gnu.org
  Target Milestone: ---

There appear to be a couple of related bugs in the framework
check-function-bodies implementation that ought to be resolvable.  I think
they're related

A simple test of the form:

/* { dg-final { check-function-bodies "**" "" "" } } */

/* This is a comment with the close on the next line
*/

int f()
{}
/*
** f:
** ...
*/

Will error out because the scanner picks up the first instance of '*/' but then
gets confused when it fails to find a pattern that marks the start of a test.

Similarly:

* { dg-final { check-function-bodies "**" "" "" } } */

int f()
{}
/*
** f:
** ...
*/

/* This is a comment with the close on the next line
*/

will run the test 'f' twice because the scanner seems to search back from a
'*/' until it finds the test-start pattern.

I think the second should be easily fixable by aborting the search for a test
if we encounter another instance of '*/' before we find the test start pattern.
 And if we can do that, then we should also be able to recover from the first
case if we reach the beginning of a file without finding a test.

Both of these can be worked around by changing the test sources to avoid
misplaced '*/' statements, but the errors from running such tests do not make
the source of the problem easy to spot.

Reply via email to