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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [pr35616.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O2" } */
3
typedef void (*listener_fun)(
4
        int a,
5
        int b,
6
        int c);
7
 
8
struct data_t
9
{
10
  int a;
11
 
12
  listener_fun listener;
13
 
14
  int b;
15
  int c;
16
  int d;
17
};
18
 
19
extern void abort(void);
20
void function_calling_listener (struct data_t data);
21
 
22
void function_calling_listener (struct data_t data)
23
{
24
  data.listener(data.a, data.c, data.d);
25
}
26
 
27
void my_listener(int a, int b, int c)
28
{
29
  if (a != 42 || b != 44 || c != 45)
30
    abort ();
31
}
32
 
33
int main()
34
{
35
  struct data_t d;
36
  d.a = 42;
37
  d.b = 43;
38
  d.c = 44;
39
  d.d = 45;
40
  d.listener = my_listener;
41
  function_calling_listener (d);
42
  return 0;
43
}

powered by: WebSVN 2.1.0

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