public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* New c-torture execute testcase
@ 1997-10-24  6:20 Joern Rennecke
  1998-01-19  2:06 ` Jeffrey A Law
  0 siblings, 1 reply; 2+ messages in thread
From: Joern Rennecke @ 1997-10-24  6:20 UTC (permalink / raw)
  To: tege, egcs

This is modified from 931004-12.c, but by using a struct of size 5,
a lot of different code is executed for typical 32 bit targets -
I was looking for the reason why the MUST_PASS_IN_STACK problem didn't
bite me on the SH as on the d10v, and found out that it was only a matter
of the structure being larger than PARM_BOUNDARY.

#include <stdarg.h>

struct tiny
{
  char c;
  char d;
  char e;
  char f;
  char g;
};

f (int n, ...)
{
  struct tiny x;
  int i;

  va_list ap;
  va_start (ap,n);
  for (i = 0; i < n; i++)
    {
      x = va_arg (ap,struct tiny);
      if (x.c != i + 10)
	abort();
      if (x.d != i + 20)
	abort();
      if (x.e != i + 30)
	abort();
      if (x.f != i + 40)
	abort();
      if (x.g != i + 50)
	abort();
    }
  {
    long x = va_arg (ap, long);
    if (x != 123)
      abort();
  }
  va_end (ap);
}

main ()
{
  struct tiny x[3];
  x[0].c = 10;
  x[1].c = 11;
  x[2].c = 12;
  x[0].d = 20;
  x[1].d = 21;
  x[2].d = 22;
  x[0].e = 30;
  x[1].e = 31;
  x[2].e = 32;
  x[0].f = 40;
  x[1].f = 41;
  x[2].f = 42;
  x[0].g = 50;
  x[1].g = 51;
  x[2].g = 52;
  f (3, x[0], x[1], x[2], (long) 123);
  exit(0);
}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: New c-torture execute testcase
  1997-10-24  6:20 New c-torture execute testcase Joern Rennecke
@ 1998-01-19  2:06 ` Jeffrey A Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeffrey A Law @ 1998-01-19  2:06 UTC (permalink / raw)
  To: Joern Rennecke; +Cc: tege, egcs

  In message <199710241319.OAA22049@phal.cygnus.co.uk>you write:
  > This is modified from 931004-12.c, but by using a struct of size 5,
  > a lot of different code is executed for typical 32 bit targets -
  > I was looking for the reason why the MUST_PASS_IN_STACK problem didn't
  > bite me on the SH as on the d10v, and found out that it was only a matter
  > of the structure being larger than PARM_BOUNDARY.
I've added this to the egcs testsuite as strct-stdarg-1.c.  We can rename
as necessary if it's included under a different name in the next c-torture
release.

jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-01-19  2:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-24  6:20 New c-torture execute testcase Joern Rennecke
1998-01-19  2:06 ` Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).