A couple of gcc.dg/debug/dwarf2/dwarf-btf-*-tag-*.c tests FAIL on
Solaris/SPARC when the native assembler is used:

FAIL: gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c scan-assembler-times  
DW_AT_const_value: "my_foo" 1
FAIL: gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c scan-assembler-times  
DW_AT_name: "btf_decl_tag" 1
FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c scan-assembler-times  
DW_AT_const_value: "__user" 1
FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c scan-assembler-times  
DW_AT_name: "btf_type_tag" 1
FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c scan-assembler-times  
DW_AT_name: "btf_decl_tag" 1
FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c scan-assembler-times  
DW_AT_name: "btf_type_tag" 1
FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c scan-assembler-times  
DW_AT_const_value: "tag1" 1
FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c scan-assembler-times  
DW_AT_const_value: "tag2" 1
FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c scan-assembler-times  
DW_AT_name: "btf_type_tag" 1
FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c scan-assembler-times  
DW_AT_const_value: "tagged_arr" 1
FAIL: gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c scan-assembler-times  
DW_AT_name: "btf_type_tag" 1

All of them FAIL in the same way: when gas is used, the tests contain
something like

        .uaword .LLASF4 ! DW_AT_const_value: "my_foo"

while for /bin/as

        .ascii "my_foo\0"       ! DW_AT_const_value

is emitted.  While other dwarf2 tests support both forms, the tests
above don't.  This patch fixes this. To make the regex more readable,
they are switched to using braces instead of double quotes, thus
avoiding excessive escaping.  At the same time, they now use
newline-sensitive matching to avoid .* matching across lines.

Tested on sparc-sun-solaris2.11 with as and gas, and
x86_64-pc-linux-gnu.

Ok for trunk.

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2025-11-22  Rainer Orth  <[email protected]>

        * gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c
        (scan-assembler-times): Switch to brace quotes.
        Allow for alternative assembler syntax.
        * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c: Likewise.
        * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c: Likewise.
        * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c: Likewise.
        * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c: Likewise.
        * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c: Likewise.

# HG changeset patch
# Parent  8537eebac18aa16a188e788148a8f75532d312d6
testsuite: Fix gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-*.c with Solaris/SPARC as

diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c
@@ -5,7 +5,7 @@
 
 int *foo __attribute__((btf_decl_tag ("my_foo")));
 
-/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 1 } } */
-/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_decl_tag\"" 1 } } */
-/* { dg-final { scan-assembler-times " DW_AT_const_value: \"my_foo\"" 1 } } */
-/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 1 } } */
+/* { dg-final { scan-assembler-times {(?n)DIE \(.*\) DW_TAG_GNU_annotation} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)( DW_AT_name: "btf_decl_tag"|"btf_decl_tag..".*DW_AT_name)} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)( DW_AT_const_value: "my_foo"|"my_foo..".*DW_AT_const_value)} 1 } } */
+/* { dg-final { scan-assembler-times { DW_AT_GNU_annotation} 1 } } */
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c
@@ -4,7 +4,7 @@
 
 int * __attribute__((btf_type_tag("__user"))) ptr;
 
-/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 1 } } */
-/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_type_tag\"" 1 } } */
-/* { dg-final { scan-assembler-times " DW_AT_const_value: \"__user\"" 1 } } */
-/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 1 } } */
+/* { dg-final { scan-assembler-times {(?n)DIE \(.*\) DW_TAG_GNU_annotation} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)( DW_AT_name: "btf_type_tag"| "btf_type_tag..".*DW_AT_name)} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)( DW_AT_const_value: "__user"|"__user..".*DW_AT_const_value)} 1 } } */
+/* { dg-final { scan-assembler-times { DW_AT_GNU_annotation} 1 } } */
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c
@@ -16,5 +16,5 @@ foo (int *x, int *y)
 /* Ideally, verify that AT_GNU_annotation in the subprogram DIE refers to
    the decl_tag annotation DIE, and the AT_GNU_annotation in the return
    type refers to the type_tag...  */
-/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_type_tag\"" 1 } } */
-/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_decl_tag\"" 1 } } */
+/* { dg-final { scan-assembler-times {(?n)( DW_AT_name: "btf_type_tag"|"btf_type_tag..".*DW_AT_name)} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)( DW_AT_name: "btf_decl_tag"|"btf_decl_tag..".*DW_AT_name)} 1 } } */
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c
@@ -20,12 +20,12 @@ struct S * __tag1 __tag2 my_S;
 
 /* Only 2 DW_TAG_GNU_annotation DIEs should be generated, one each for "tag1"
    and "tag2", and they should be reused.  */
-/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 2 } } */
-/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_type_tag\"" 2 } } */
-/* { dg-final { scan-assembler-times " DW_AT_const_value: \"tag1\"" 1 } } */
-/* { dg-final { scan-assembler-times " DW_AT_const_value: \"tag2\"" 1 } } */
+/* { dg-final { scan-assembler-times {(?n)DIE \(.*\) DW_TAG_GNU_annotation} 2 } } */
+/* { dg-final { scan-assembler-times { DW_AT_name: "btf_type_tag"} 2 } } */
+/* { dg-final { scan-assembler-times {(?n)( DW_AT_const_value: "tag1"|"tag1..".* DW_AT_const_value)} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)( DW_AT_const_value: "tag2"|"tag2..".*DW_AT_const_value)} 1 } } */
 
 /* Each attribute-ed type shall refer via DW_AT_GNU_annotation to the
    appropriate annotation DIE, including the annotation DIE for "tag2" which
    is always chained to the DIE for "tag1" in this construction.  */
-/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 5 } } */
+/* { dg-final { scan-assembler-times { DW_AT_GNU_annotation} 5 } } */
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c
@@ -29,6 +29,6 @@ union U
 volatile union U volatile_u;
 
 /* One annotation DIE may be shared by all three annotated types.  */
-/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 1 } } */
-/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_type_tag\"" 1 } } */
-/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 3 } } */
+/* { dg-final { scan-assembler-times {(?n)DIE \(.*\) DW_TAG_GNU_annotation} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)( DW_AT_name: "btf_type_tag"|"btf_type_tag..".* DW_AT_name)} 1 } } */
+/* { dg-final { scan-assembler-times { DW_AT_GNU_annotation} 3 } } */
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c
@@ -4,7 +4,7 @@
 
 int arr[8] __attribute__((btf_type_tag("tagged_arr")));
 
-/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 1 } } */
-/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_type_tag\"" 1 } } */
-/* { dg-final { scan-assembler-times " DW_AT_const_value: \"tagged_arr\"" 1 } } */
-/* { dg-final { scan-assembler-times " DW_AT_GNU_annotation" 1 } } */
+/* { dg-final { scan-assembler-times {(?n)DIE \(.*\) DW_TAG_GNU_annotation} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)( DW_AT_name: "btf_type_tag"|"btf_type_tag..".*)} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)( DW_AT_const_value: "tagged_arr"|"tagged_arr..".*DW_AT_const_value)} 1 } } */
+/* { dg-final { scan-assembler-times { DW_AT_GNU_annotation} 1 } } */

Reply via email to