OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20070919-1.c] - Rev 774

Go to most recent revision | Compare with Previous | Blame | View Log

/* PR c/33238 */
 
typedef __SIZE_TYPE__ size_t;
int memcmp (const void *, const void *, size_t);
void abort (void);
 
void
__attribute__((noinline))
bar (void *x, void *y)
{
  struct S { char w[8]; } *p = x, *q = y;
  if (memcmp (p->w, "zyxwvut", 8) != 0)
    abort ();
  if (memcmp (q[0].w, "abcdefg", 8) != 0)
    abort ();
  if (memcmp (q[1].w, "ABCDEFG", 8) != 0)
    abort ();
  if (memcmp (q[2].w, "zyxwvut", 8) != 0)
    abort ();
  if (memcmp (q[3].w, "zyxwvut", 8) != 0)
    abort ();
}
 
void
__attribute__((noinline))
foo (void *x, int y)
{
  struct S { char w[y]; } *p = x, a;
  int i;
  a = ({ struct S b; b = p[2]; p[3] = b; });
  bar (&a, x);
}
 
int
main (void)
{
  struct S { char w[8]; } p[4]
    = { "abcdefg", "ABCDEFG", "zyxwvut", "ZYXWVUT" };
  foo (p, 8);
  return 0;
}
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.