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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libmudflap/] [testsuite/] [libmudflap.c/] [pass64-frag.c] - Rev 848

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

/* PR libmudflap/36397 */
/* { dg-do run } */
/* { dg-options "-O -fmudflap -fno-strict-aliasing -lmudflap" } */
 
struct A
{
  int a[2];
};
 
long long int x;
 
int __attribute__ ((noinline))
baz (long long int *x)
{
  return *x;
}
 
int __attribute__ ((noinline))
foo (int i)
{
  if (i > 10)
    return baz (&x);
  return ((struct A *) &x)->a[i];
}
 
int
main (void)
{
  if (sizeof (long long) == 2 * sizeof (int)
      && sizeof (long long) == sizeof (struct A))
    {
      struct A a = { .a[0] = 10, .a[1] = 20 };
      __builtin_memcpy (&x, &a, sizeof (x));
      if (foo (0) != 10 || foo (1) != 20)
        __builtin_abort ();
    }
  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.