5 /* Check that function wrapping works for a mutually recursive
11 /* This is needed to stop gcc4 turning 'fact' into a loop */
12 __attribute__((noinline
))
13 int mul ( int x
, int y
) { return x
* y
; }
15 __attribute((noinline
))
18 if (n
== 0) return 1; else return mul(n
, fact2(n
-1));
20 __attribute((noinline
))
23 if (n
== 0) return 1; else return mul(n
, fact1(n
-1));
27 int I_WRAP_SONAME_FNNAME_ZU(NONE
,fact1
) ( int n
)
31 VALGRIND_GET_ORIG_FN(fn
);
32 printf("in wrapper1-pre: fact(%d)\n", n
);
34 printf("in wrapper1-post: fact(%d) = %d\n", n
, r
);
38 int I_WRAP_SONAME_FNNAME_ZU(NONE
,fact2
) ( int n
)
42 VALGRIND_GET_ORIG_FN(fn
);
43 printf("in wrapper2-pre: fact(%d)\n", n
);
45 printf("in wrapper2-post: fact(%d) = %d\n", n
, r
);
54 printf("computing fact1(5)\n");
56 printf("fact1(5) = %d\n", r
);