Commit | Line | Data |
---|---|---|
5f7cbeec L |
1 | #include <stdio.h> |
2 | ||
3 | extern int foo(void); | |
4 | extern int bar(void); | |
5 | ||
731885c1 L |
6 | typedef int (*func_p) (void); |
7 | ||
8 | func_p foo_ptr = foo; | |
9 | ||
10 | func_p | |
11 | __attribute__((noinline)) | |
12 | get_bar (void) | |
13 | { | |
14 | return bar; | |
15 | } | |
5f7cbeec L |
16 | |
17 | int | |
18 | main (void) | |
19 | { | |
731885c1 | 20 | func_p bar_ptr = get_bar (); |
5f7cbeec L |
21 | if (bar_ptr != bar) |
22 | __builtin_abort (); | |
23 | if (bar_ptr() != -1) | |
24 | __builtin_abort (); | |
25 | if (bar() != -1) | |
26 | __builtin_abort (); | |
27 | ||
28 | if (foo_ptr != foo) | |
29 | __builtin_abort (); | |
30 | if (foo_ptr() != 1) | |
31 | __builtin_abort (); | |
32 | if (foo() != 1) | |
33 | __builtin_abort (); | |
34 | ||
35 | printf ("OK\n"); | |
36 | ||
37 | return 0; | |
38 | } |