diff mbox series

[6/6] Backport power10 prefix stack protect test.

Message ID 20200804060414.GF6014@ibm-tinman.the-meissners.org
State New
Headers show
Series Backport power10 prefixed instruction tests to GCC 10 | expand

Commit Message

Michael Meissner Aug. 4, 2020, 6:04 a.m. UTC
Backport power10 prefix stack protect test.

This test makes sure whether large stack frames can be handled if the
-fstack-protector-stron option was used.  This bug was noticed when we tried to
build GLIBC for the power10.  This test has been on the master branch since
June, and not changes were needed to backport it to GCC 10.  Can I check this
into the GCC 10 branch?

gcc/testsuite/
2020-08-03  Michael Meissner  <meissner@linux.ibm.com>

	Backport from the master branch:
	2020-06-27  Michael Meissner  <meissner@linux.ibm.com>

	* gcc.target/powerpc/prefix-stack-protect.c: New test.

---
 .../gcc.target/powerpc/prefix-stack-protect.c       | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-stack-protect.c
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/powerpc/prefix-stack-protect.c b/gcc/testsuite/gcc.target/powerpc/prefix-stack-protect.c
new file mode 100644
index 0000000..ca3b3df
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/prefix-stack-protect.c
@@ -0,0 +1,21 @@ 
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_prefixed_addr } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10 -fstack-protector-strong" } */
+
+/* Test that we can handle large stack frames with -fstack-protector-strong and
+   prefixed addressing.  This was originally discovered when trying to build
+   glibc with -mcpu=power10, and vfwprintf.c failed because it used
+   -fstack-protector-strong.  It needs 64-bit due to the size of the stack.  */
+
+extern long foo (char *);
+
+long
+bar (void)
+{
+  char buffer[0x20000];
+  return foo (buffer) + 1;
+}
+
+/* { dg-final { scan-assembler {\mpld\M}  } } */
+/* { dg-final { scan-assembler {\mpstd\M} } } */