Skip to content

Commit 12f3221

Browse files
authored
Merge pull request #154 from jumormt/master
Create funptr-nested-struct-simple.c
2 parents a8ff996 + 6cc9c03 commit 12f3221

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
extern void MAYALIAS(void*,void*);
2+
struct interesting {
3+
int dummy;
4+
void (*f1)(int*);
5+
void (*f2)(int*);
6+
};
7+
8+
struct nested_ptr {
9+
int dummy;
10+
struct interesting* ptr;
11+
};
12+
13+
int g;
14+
void f1(int* a){ MAYALIAS(a, &g);}
15+
void f2(int* a){ MAYALIAS(a, &g);}
16+
17+
struct interesting i1 = {
18+
.f1 = f1,
19+
.f2 = f2
20+
};
21+
22+
struct nested_ptr n1 = {
23+
.ptr = &i1
24+
};
25+
26+
void test_ptr() {
27+
struct interesting interesting_stub = *n1.ptr;
28+
interesting_stub.f1(&g);
29+
interesting_stub.f2(&g);
30+
}

0 commit comments

Comments
 (0)