re PR target/34281 (ARM: varargs broken with 64bit parameters.)

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.

From-SVN: r131196
This commit is contained in:
Jakub Jelinek 2007-12-27 09:31:54 +01:00 committed by Jakub Jelinek
parent e2925ff210
commit 22ccaaeea7
4 changed files with 73 additions and 4 deletions

View File

@ -1,5 +1,10 @@
2007-12-27 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.
PR debug/34535
* tree-mudflap.c (mf_make_builtin): Make decl artificial
and don't emit debug info for it.

View File

@ -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

View File

@ -1,3 +1,8 @@
2007-12-27 Jakub Jelinek <jakub@redhat.com>
PR target/34281
* gcc.c-torture/execute/20071213-1.c: New test.
2007-12-25 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/34560

View File

@ -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;
}