]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Fix gcc.dg/debug/dwarf2/dwarf-btf-*-tag-*.c with Solaris/SPARC as
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Tue, 25 Nov 2025 08:15:17 +0000 (09:15 +0100)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Tue, 25 Nov 2025 08:15:17 +0000 (09:15 +0100)
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.

2025-11-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

* 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.

gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c
gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c
gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c
gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c
gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c
gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c

index a1c1676a7ba34edd4f5d023283813e2ce1f7f003..38739e45976a4e62db86d8133a02781e3bafc325 100644 (file)
@@ -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 } } */
index 772aab09cfb71e334f4df7f074af6d202993a003..437b981b9146ff41f5e4ff0fd3d9730c15d691c7 100644 (file)
@@ -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 } } */
index 3ecd79f092fc2dacad29e0b2a866c3fb0afbefc9..7af1452776cc2df9160770ea7e93e7834e9028df 100644 (file)
@@ -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 } } */
index 9c44e0ee0b99f46911aec4fa7f071683224775fd..467d759521ac3a9853d2c543b8fefbbd95bbac3e 100644 (file)
@@ -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 } } */
index 7205ef2c9a34a52f14f3d67374faf94dec13cb51..212cc4eca47640b0652fe892dc9fc29d729775d9 100644 (file)
@@ -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 } } */
index 1a6b29f99a1a0f0b54b01ec39f5dc7ec49545a32..ffb2ca8258edf616b57ea3476817bea47a112fce 100644 (file)
@@ -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 } } */