]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: Fix g++.dg/ext/attr-section2.C etc. with Solaris/SPARC as
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Thu, 1 Feb 2024 11:46:20 +0000 (12:46 +0100)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Thu, 1 Feb 2024 11:46:20 +0000 (12:46 +0100)
The new g++.dg/ext/attr-section2*.C tests FAIL on Solaris/SPARC with the
native assembler:

+FAIL: g++.dg/ext/attr-section2.C -std=c++14 scan-assembler
.(section|csect)[ \\\\t]+.foo
+FAIL: g++.dg/ext/attr-section2.C -std=c++17 scan-assembler
.(section|csect)[ \\\\t]+.foo
+FAIL: g++.dg/ext/attr-section2.C -std=c++20 scan-assembler
.(section|csect)[ \\\\t]+.foo

The problem is that the SPARC assembler requires the section name to be
double-quoted, like

        .section        ".foo%_Z3varIiE",#alloc,#write,#progbits

This patch allows for that.  At the same time, it quotes literal dots in
the REs.

Tested on sparc-sun-solaris2.11 (as and gas) and i386-pc-solaris2.11 (as
and gas).

2024-01-18  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
* g++.dg/ext/attr-section2.C (scan-assembler): Quote dots.  Allow
for double-quoted section name.
* g++.dg/ext/attr-section2a.C: Likewise.
* g++.dg/ext/attr-section2b.C: Likewise.

gcc/testsuite/g++.dg/ext/attr-section2.C
gcc/testsuite/g++.dg/ext/attr-section2a.C
gcc/testsuite/g++.dg/ext/attr-section2b.C

index 7c9221b73aa5ae7c87f29d1efddf9e70f6f39e72..81567c10b77492455dac75a91392575b8e565aec 100644 (file)
@@ -6,4 +6,4 @@ template<class T>
 
 template int var<int>;
 
-// { dg-final { scan-assembler {.(section|csect)[ \t]+.foo} } }
+// { dg-final { scan-assembler {\.(section|csect)[ \t]+"?\.foo} } }
index 4fa898c54edd1b7d96a5905ea7640463641ce5b4..97b3a10a178ca0f06195ac83cdd6709bcc0aa3ed 100644 (file)
@@ -11,4 +11,4 @@ int A<T>::var = 42;
 
 template struct A<int>;
 
-// { dg-final { scan-assembler {.(section|csect)[ \t]+.foo} } }
+// { dg-final { scan-assembler {\.(section|csect)[ \t]+"?\.foo} } }
index 93987733ff2f5e297c34d4e2b1708294038fe9d8..bef0377016d138bdca735e1bb48898d789550a86 100644 (file)
@@ -9,4 +9,4 @@ int* fun() {
 
 template int* fun<int>();
 
-// { dg-final { scan-assembler {.(section|csect)[ \t]+.foo} } }
+// { dg-final { scan-assembler {\.(section|csect)[ \t]+"?\.foo} } }