This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] PR19616, take 2


On Tuesday 25 January 2005 22:58, Richard Henderson wrote:
> On Tue, Jan 25, 2005 at 10:11:50PM +0100, Steven Bosscher wrote:
> > A less pessimistic fix is to just disallow TER to propagate expressions
> > into the argument list of a call that may be a tail call.  That way, to
> > expand all the arguments will be GIMPLE registers, and the arguments
> > are always evaluated before setting up the arguments for the sibcall.
>
> Except that only works if all the arguments are registers.  Consider
>
> 	struct S { int w, x, y, z; };
> 	struct T { int r; struct S s; };
>
> 	void bar(struct S, int);
>
> 	void foo(int a, struct T b)
> 	{
> 	  struct S *c = 0;
> 	  if (a)
> 	    c = &b.s;
> 	  bar (*c, a);
> 	}

For this test, bar is not in a tail position, so...?

The original test case for PR15387 was for a struct:

-------------------------------------------------------
extern void abort (void) __attribute__ ((noreturn));
extern void exit (int) __attribute__ ((noreturn));

struct foo { int a, b, c; };

void
brother (int a, int b)
{
  if (a)
    abort ();
}


void
sister (struct foo f, int b)
{
  int *tmp = &f.b;

  brother (*tmp == b, b);
}

int
main (void)
{
  struct foo f;

  f.a = 7;
  f.b = 8;
  f.c = 9;
  sister (f, 1);
  exit (0);
}
-------------------------------------------------------

This passes with and without the patch on mainline, and only with
the patch for GCCs between the tree-ssa merge and 2004-07-28.

Gr.
Steven


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]