From 31a18a7e231474e40309e930e8705d62a38ffdd5 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 25 May 2012 20:48:19 +0000 Subject: 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 --- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/split-6.c | 53 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/split-6.c (limited to 'gcc') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 22a29b8..285ae9c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2012-05-25 Ian Lance Taylor + + * gcc.dg/split-6.c: New test. + 2012-05-25 Eric Botcazou * gnat.dg/lto14.adb: New test. 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 +#include + +/* 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; +} -- cgit v1.1