OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [pr35616.c] - Rev 300

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.