fix asm-not pattern in dwarf2/inline5.c
authorAlexandre Oliva <oliva@adacore.com>
Wed, 28 Apr 2021 17:07:41 +0000 (14:07 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Wed, 28 Apr 2021 17:07:41 +0000 (14:07 -0300)
commit16683cefc636636ba6fed23fe0de89ed19bc7876
treec0a4f1a055819609ae7aa0c3001f9d1e9ac07496
parent59f5d16f2c5db4d9592c8ce6453afe81334bb012
fix asm-not pattern in dwarf2/inline5.c

The test is supposed to check that the abstract lexical block of a
function that was inlined doesn't have attributes, and that the
concrete inlined lexical block does.

There are two patterns to verify the absence of attributes in the
abstract lexical block, one for the case in which the concrete block
appears after the abstract one, and another for the case in which it's
before.

The former has a problem that is not visible when asm comments start
with a single character, but that becomes apparent when they start
with "/ ".

The pattern starts by matching the abstract DW_TAG_lexical_block DIE
header, and checking that the next line has, after any of the
comment-starter characters (e.g. '/'), there are one or more blanks '
+', and then a character other than the '(' that would start another
DIE.

The problem is that '[.../...]+ +[^(].*' matches '/  (DIE...', because
'[^(]' may match the second blank, and after that anything goes.  So
we end up recognizing the pattern, as if it was an abstract lexical
block with an attribute.

This could be minimally fixed by changing '[^(]' to '[^ (]', but the
pattern that matches concrete before abstract checks for an explicit
DW_AT after the abstract DIE, so I'm using that in the other pattern
as well.

For reference, the lines that start the unwanted match are:
.uleb128 0xc /  (DIE (0xa4) DW_TAG_lexical_block)
.uleb128 0xd /  (DIE (0xa5) DW_TAG_variable)

for  gcc/testsuite/ChangeLog

* gcc.dg/debug/dwarf2/inline5.c: Adjust pattern to avoid
mismatch when asm comments start with "/ ".
gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c