[Darwin,c++,testsuite] Fix alignas4.C for Darwin.

Message ID 383C8948-4660-4C15-BE00-BC077E9F510C@sandoe.co.uk
State New
Headers show
Series
  • [Darwin,c++,testsuite] Fix alignas4.C for Darwin.
Related show

Commit Message

Iain Sandoe June 6, 2019, 7:28 p.m.
This test was failing on Darwin because the scan-asm clauses only excluded
Darwin for m64 and the m32 syntax for Darwin is different, as below.

@Rainer, Mike: the tests for non-Darwin are somewhat strange (although I have
not modified them other than to exclude Darwin for 32b).
(a) the tests seem to be x86 only (m64 explicitly and m32 implicitly by using ia32
 as a guard).
(b) they only seem to care if there’s one instance of the aligment statement but
there are two objects?
(just mentioning in passing)

Darwin produces aligned zerofill directives for the objects represented.
We can scan for these using "lp64" and "ilp32" to catch operation on both
X86 and PowerPC ports (the test is for the alignment which is the trailing
value in the zerofill directive, as a power of two).

tested on x86_64-darwin16, 18 and x86_64-linux-gnu (m32, m64)
Applied to mainline,
thanks
Iain

gcc/testsuite/ChangeLog:

2019-06-06  Iain Sandoe  <iain@sandoe.co.uk>

	* g++.dg/cpp0x/alignas4.C: Amend test to check for zerofill syntax
	on Darwin.

Patch

diff --git a/gcc/testsuite/g++.dg/cpp0x/alignas4.C b/gcc/testsuite/g++.dg/cpp0x/alignas4.C
index b66fa65..1ef4870 100644
--- a/gcc/testsuite/g++.dg/cpp0x/alignas4.C
+++ b/gcc/testsuite/g++.dg/cpp0x/alignas4.C
@@ -1,7 +1,13 @@ 
 // PR c++/59012
 // { dg-do compile { target c++11 } }
 // { dg-final { scan-assembler "align 8" { target { { i?86-*-* x86_64-*-* } && { { ! ia32 } && { ! *-*-darwin* } } } } } }
-// { dg-final { scan-assembler "align 4" { target ia32 } } }
+// { dg-final { scan-assembler "align 4" { target { ia32 && { ! *-*-darwin* } } } } }
+
+// Darwin produces aligned .zerofill directives for these.
+// { dg-final { scan-assembler {zerofill[^\n\r]+_a,4,2} { target { ilp32 && *-*-darwin* } } } }
+// { dg-final { scan-assembler {zerofill[^\n\r]+_a,8,3} { target { lp64 && *-*-darwin* } } } }
+// { dg-final { scan-assembler {zerofill[^\n\r]+_a2,4,2} { target { ilp32 && *-*-darwin* } } } }
+// { dg-final { scan-assembler {zerofill[^\n\r]+_a2,8,3} { target { lp64 && *-*-darwin* } } } }
 
 template <class... T>
 struct A