aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/union-2.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@libertysurf.fr>2004-11-10 18:24:19 +0100
committerEric Botcazou <ebotcazou@gcc.gnu.org>2004-11-10 17:24:19 +0000
commit22d8d62798a3ce51a7e328805593bf675eddf60f (patch)
tree519d44fed7e51de0d70afcb9657d3224501a3194 /gcc/testsuite/gcc.dg/union-2.c
parentd05f9c39a3a6e7d9a95de9c134d13c1a34f1c70d (diff)
downloadgcc-22d8d62798a3ce51a7e328805593bf675eddf60f.zip
gcc-22d8d62798a3ce51a7e328805593bf675eddf60f.tar.gz
gcc-22d8d62798a3ce51a7e328805593bf675eddf60f.tar.bz2
sparc.c (function_arg_union_value): New 'slotno' argument.
* config/sparc/sparc.c (function_arg_union_value): New 'slotno' argument. When the union is passed in the 6th slot, build a PARALLEL with only one element. (function_arg): Adjust call to function_arg_union_value. (function_value): Likewise. From-SVN: r90396
Diffstat (limited to 'gcc/testsuite/gcc.dg/union-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/union-2.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/union-2.c b/gcc/testsuite/gcc.dg/union-2.c
new file mode 100644
index 0000000..edc8a7a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/union-2.c
@@ -0,0 +1,28 @@
+/* This used to segfault on SPARC 64-bit at runtime because
+ the stack pointer was clobbered by the function call. */
+
+/* { dg-do run } */
+
+#include <stdarg.h>
+
+union U
+{
+ long l1[2];
+};
+
+union U u;
+
+void foo (int z, ...)
+{
+ int i;
+ va_list ap;
+ va_start(ap,z);
+ i = va_arg(ap, int);
+ va_end(ap);
+}
+
+int main(void)
+{
+ foo (1, 1, 1, 1, 1, u);
+ return 0;
+}