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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [pr41935.c] - Rev 858

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

/* PR middle-end/41935 */
/* { dg-do run } */
/* { dg-options "-O2" } */
 
extern void abort (void);
struct A { int a; int b[10]; };
 
int
foo (struct A *p)
{
  return __builtin_offsetof (struct A, b[p->a]);
}
 
int
main ()
{
  struct A a;
  a.a = 7;
  if (foo (&a) != 7 * sizeof (int) + __builtin_offsetof (struct A, b))
    abort ();
  a.a = 2;
  if (foo (&a) != 2 * sizeof (int) + __builtin_offsetof (struct A, b))
    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.