93 lines
2.1 KiB
Diff
93 lines
2.1 KiB
Diff
2007-12-13 Jakub Jelinek <jakub@redhat.com>
|
|
|
|
PR target/34281
|
|
* config/arm/arm.c (arm_setup_incoming_varargs): If last named
|
|
argument needs double word alignment and cum->nregs is odd, account
|
|
for the inserted padding.
|
|
|
|
* gcc.c-torture/execute/20071213-1.c: New test.
|
|
|
|
--- gcc/config/arm/arm.c.jj 2007-12-11 00:23:29.000000000 +0100
|
|
+++ gcc/config/arm/arm.c 2007-12-13 15:26:01.000000000 +0100
|
|
@@ -17765,14 +17765,20 @@ arm_output_load_gr (rtx *operands)
|
|
|
|
static void
|
|
arm_setup_incoming_varargs (CUMULATIVE_ARGS *cum,
|
|
- enum machine_mode mode ATTRIBUTE_UNUSED,
|
|
- tree type ATTRIBUTE_UNUSED,
|
|
+ enum machine_mode mode,
|
|
+ tree type,
|
|
int *pretend_size,
|
|
int second_time ATTRIBUTE_UNUSED)
|
|
{
|
|
+ int nregs = cum->nregs;
|
|
+ if (nregs & 1
|
|
+ && ARM_DOUBLEWORD_ALIGN
|
|
+ && arm_needs_doubleword_align (mode, type))
|
|
+ nregs++;
|
|
+
|
|
cfun->machine->uses_anonymous_args = 1;
|
|
- if (cum->nregs < NUM_ARG_REGS)
|
|
- *pretend_size = (NUM_ARG_REGS - cum->nregs) * UNITS_PER_WORD;
|
|
+ if (nregs < NUM_ARG_REGS)
|
|
+ *pretend_size = (NUM_ARG_REGS - nregs) * UNITS_PER_WORD;
|
|
}
|
|
|
|
/* Return nonzero if the CONSUMER instruction (a store) does not need
|
|
--- gcc/testsuite/gcc.c-torture/execute/20071213-1.c.jj 2007-12-13 16:47:49.000000000 +0100
|
|
+++ gcc/testsuite/gcc.c-torture/execute/20071213-1.c 2007-12-13 16:47:12.000000000 +0100
|
|
@@ -0,0 +1,53 @@
|
|
+/* PR target/34281 */
|
|
+
|
|
+#include <stdarg.h>
|
|
+
|
|
+extern void abort (void);
|
|
+
|
|
+void
|
|
+h (int x, va_list ap)
|
|
+{
|
|
+ switch (x)
|
|
+ {
|
|
+ case 1:
|
|
+ if (va_arg (ap, int) != 3 || va_arg (ap, int) != 4)
|
|
+ abort ();
|
|
+ return;
|
|
+ case 5:
|
|
+ if (va_arg (ap, int) != 9 || va_arg (ap, int) != 10)
|
|
+ abort ();
|
|
+ return;
|
|
+ default:
|
|
+ abort ();
|
|
+ }
|
|
+}
|
|
+
|
|
+void
|
|
+f1 (int i, long long int j, ...)
|
|
+{
|
|
+ va_list ap;
|
|
+ va_start (ap, j);
|
|
+ h (i, ap);
|
|
+ if (i != 1 || j != 2)
|
|
+ abort ();
|
|
+ va_end (ap);
|
|
+}
|
|
+
|
|
+void
|
|
+f2 (int i, int j, int k, long long int l, ...)
|
|
+{
|
|
+ va_list ap;
|
|
+ va_start (ap, l);
|
|
+ h (i, ap);
|
|
+ if (i != 5 || j != 6 || k != 7 || l != 8)
|
|
+ abort ();
|
|
+ va_end (ap);
|
|
+}
|
|
+
|
|
+int
|
|
+main ()
|
|
+{
|
|
+ f1 (1, 2, 3, 4);
|
|
+ f2 (5, 6, 7, 8, 9, 10);
|
|
+ return 0;
|
|
+}
|