aboutsummaryrefslogtreecommitdiff
path: root/SingleSource/Regression/C/gcc-c-torture/execute/va-arg-4.c
diff options
context:
space:
mode:
Diffstat (limited to 'SingleSource/Regression/C/gcc-c-torture/execute/va-arg-4.c')
-rw-r--r--SingleSource/Regression/C/gcc-c-torture/execute/va-arg-4.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/SingleSource/Regression/C/gcc-c-torture/execute/va-arg-4.c b/SingleSource/Regression/C/gcc-c-torture/execute/va-arg-4.c
new file mode 100644
index 00000000..a824f64f
--- /dev/null
+++ b/SingleSource/Regression/C/gcc-c-torture/execute/va-arg-4.c
@@ -0,0 +1,33 @@
+/* On the i960 any arg bigger than 16 bytes causes all subsequent args
+ to be passed on the stack. We test this. */
+
+#include <stdarg.h>
+
+typedef struct {
+ char a[32];
+} big;
+
+void
+f (big x, char *s, ...)
+{
+ va_list ap;
+
+ if (x.a[0] != 'a' || x.a[1] != 'b' || x.a[2] != 'c')
+ abort ();
+ va_start (ap, s);
+ if (va_arg (ap, int) != 42)
+ abort ();
+ if (va_arg (ap, int) != 'x')
+ abort ();
+ if (va_arg (ap, int) != 0)
+ abort ();
+ va_end (ap);
+}
+
+main ()
+{
+ static big x = { "abc" };
+
+ f (x, "", 42, 'x', 0);
+ exit (0);
+}