summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-2664.c
blob: 7f2987a1e9af8c7e192f1ea661aea259010b41d5 (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
/* bug-2664.c
   A frontend issue in the handling of functions returning function pointers (without using a typedef)
 */

#include <testfwk.h>

int i;

void (*s(int signo, void (*func)(int signo) __reentrant))(int signo)
{
	func(signo);
    return(func);
}

void (*f(int j))(void)
{
	i = j;
    return 0;
}

void g(int j) __reentrant
{
	i = j;
}

void
testBug(void)
{
	f(1);
	ASSERT (i == 1);
	s(2, &g);
	ASSERT (i == 2);
}