aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/split-6.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-05-25 20:48:19 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-05-25 20:48:19 +0000
commit31a18a7e231474e40309e930e8705d62a38ffdd5 (patch)
tree9b7c31e86ff93c95ed67b963d17e16527d404ce4 /gcc/testsuite/gcc.dg/split-6.c
parent37c59e691e40aa4f278ca985f7fa7ab81a0e545d (diff)
downloadgcc-31a18a7e231474e40309e930e8705d62a38ffdd5.zip
gcc-31a18a7e231474e40309e930e8705d62a38ffdd5.tar.gz
gcc-31a18a7e231474e40309e930e8705d62a38ffdd5.tar.bz2
morestack.S (__morestack_non_split): Check whether caller is varargs and needs %bp to hold the stack frame on return.
libgcc/: * config/i386/morestack.S (__morestack_non_split): Check whether caller is varargs and needs %bp to hold the stack frame on return. gcc/testsuite/: * gcc.dg/split-6.c: New test. From-SVN: r187894
Diffstat (limited to 'gcc/testsuite/gcc.dg/split-6.c')
-rw-r--r--gcc/testsuite/gcc.dg/split-6.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/split-6.c b/gcc/testsuite/gcc.dg/split-6.c
new file mode 100644
index 0000000..b32cf8d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/split-6.c
@@ -0,0 +1,53 @@
+/* { dg-do run } */
+/* { dg-require-effective-target split_stack } */
+/* { dg-options "-fsplit-stack" } */
+
+/* This test is like split-3.c, but tests with a smaller stack frame,
+ since that uses a different prologue. */
+
+#include <stdarg.h>
+#include <stdlib.h>
+
+/* Use a noinline function to ensure that the buffer is not removed
+ from the stack. */
+static void use_buffer (char *buf) __attribute__ ((noinline));
+static void
+use_buffer (char *buf)
+{
+ buf[0] = '\0';
+}
+
+/* When using gold, the call to abort will force a stack split. */
+
+static void
+down (int i, ...)
+{
+ char buf[1];
+ va_list ap;
+
+ va_start (ap, i);
+ if (va_arg (ap, int) != 1
+ || va_arg (ap, int) != 2
+ || va_arg (ap, int) != 3
+ || va_arg (ap, int) != 4
+ || va_arg (ap, int) != 5
+ || va_arg (ap, int) != 6
+ || va_arg (ap, int) != 7
+ || va_arg (ap, int) != 8
+ || va_arg (ap, int) != 9
+ || va_arg (ap, int) != 10)
+ abort ();
+
+ if (i > 0)
+ {
+ use_buffer (buf);
+ down (i - 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ }
+}
+
+int
+main (void)
+{
+ down (1000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ return 0;
+}