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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [pr35616.c] - Rev 801

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

/* { dg-do run } */
/* { dg-options "-O2" } */
typedef void (*listener_fun)(
        int a,
        int b,
        int c);
 
struct data_t
{
  int a;
 
  listener_fun listener;
 
  int b;
  int c;
  int d;
};
 
extern void abort(void);
void function_calling_listener (struct data_t data);
 
void function_calling_listener (struct data_t data)
{
  data.listener(data.a, data.c, data.d);
}
 
void my_listener(int a, int b, int c)
{
  if (a != 42 || b != 44 || c != 45)
    abort ();
}
 
int main()
{
  struct data_t d;
  d.a = 42;
  d.b = 43;
  d.c = 44;
  d.d = 45;
  d.listener = my_listener;
  function_calling_listener (d);
  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.