Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.dg / lto / 20120723_1.c
1 /* Make sure that by reference and by value aggregate jump functions do not get
2    mixed up.  */
3
4 extern void abort (void);
5
6 struct S
7 {
8   int i;
9   void (*f)(struct S *);
10   int j;
11 };
12
13 struct E
14 {
15   struct S *p;
16 };
17
18 extern struct S *gs;
19 extern int gr;
20 extern char gc[1024];
21
22 static __attribute__ ((noinline, noclone)) struct S *
23 get_s (void)
24 {
25   return (struct S *) &gc;
26 }
27
28 static void good_target (struct S *s)
29 {
30   gr = 0;
31 }
32
33 extern void bar (struct E e);
34
35 void foo (struct E e)
36 {
37   gs->f = good_target;
38   bar (e);
39 }