re PR target/52129 (wrong code to pass parameters to tail call function)

PR target/52129
	* calls.c (mem_overlaps_already_clobbered_arg_p): If val is
	CONST_INT_P, subtract resp. add crtl->args.pretend_args_size to it.

	* gcc.c-torture/execute/pr52129.c: New test.

From-SVN: r183933
This commit is contained in:
Jakub Jelinek 2012-02-06 14:33:05 +01:00 committed by Jakub Jelinek
parent 93286335bb
commit 2c8b5d61bc
4 changed files with 44 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2012-02-06 Jakub Jelinek <jakub@redhat.com>
PR target/52129
* calls.c (mem_overlaps_already_clobbered_arg_p): If val is
CONST_INT_P, subtract resp. add crtl->args.pretend_args_size to it.
2012-02-06 Jonathan Wakely <jwakely.gcc@gmail.com>
PR c++/48680

View File

@ -1808,6 +1808,11 @@ mem_overlaps_already_clobbered_arg_p (rtx addr, unsigned HOST_WIDE_INT size)
return true;
else
i = INTVAL (val);
#ifdef STACK_GROWS_DOWNWARD
i -= crtl->args.pretend_args_size;
#else
i += crtl->args.pretend_args_size;
#endif
#ifdef ARGS_GROW_DOWNWARD
i = -i - size;

View File

@ -1,3 +1,8 @@
2012-02-06 Jakub Jelinek <jakub@redhat.com>
PR target/52129
* gcc.c-torture/execute/pr52129.c: New test.
2012-02-06 Andrey Belevantsev <abel@ispras.ru>
* gcc.dg/pr48374.c: Actually add the test I forgot

View File

@ -0,0 +1,28 @@
/* PR target/52129 */
extern void abort (void);
struct S { void *p; unsigned int q; };
struct T { char a[64]; char b[64]; } t;
__attribute__((noinline, noclone)) int
foo (void *x, struct S s, void *y, void *z)
{
if (x != &t.a[2] || s.p != &t.b[5] || s.q != 27 || y != &t.a[17] || z != &t.b[17])
abort ();
return 29;
}
__attribute__((noinline, noclone)) int
bar (void *x, void *y, void *z, struct S s, int t, struct T *u)
{
return foo (x, s, &u->a[t], &u->b[t]);
}
int
main ()
{
struct S s = { &t.b[5], 27 };
if (bar (&t.a[2], (void *) 0, (void *) 0, s, 17, &t) != 29)
abort ();
return 0;
}