Test that stack protection generates prefixed stack instructions if you are
using large stack frame for -mcpu=future.

2020-06-01  Michael Meissner  <meiss...@linux.ibm.com>

        * gcc.target/powerpc/prefix-stack-protect.c: New test.
---
 .../gcc.target/powerpc/prefix-stack-protect.c        | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/prefix-stack-protect.c

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..d0d291b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/prefix-stack-protect.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_prefixed_addr } */
+/* { dg-options "-O2 -mdejagnu-cpu=future -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=future, and vfwprintf.c failed because it used
+   -fstack-protector-strong.  */
+
+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} } } */
-- 
1.8.3.1

Reply via email to