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