From 77d7ea04acb56f839031993c102366e30cad5c25 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Sun, 18 Dec 2016 05:18:19 +0100 Subject: Fix gawk miscompile See testcase. Function pointer use was hosed when the destination function wasn't also called normally by the program. --- tests/tests2/42_function_pointer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/tests2/42_function_pointer.c') diff --git a/tests/tests2/42_function_pointer.c b/tests/tests2/42_function_pointer.c index 49c331b..697bd79 100644 --- a/tests/tests2/42_function_pointer.c +++ b/tests/tests2/42_function_pointer.c @@ -8,9 +8,13 @@ int fred(int p) int (*f)(int) = &fred; +/* To test what this is supposed to test the destination function + (fprint here) must not be called directly anywhere in the test. */ +int (*fprintfptr)(FILE *, const char *, ...) = &fprintf; + int main() { - printf("%d\n", (*f)(24)); + fprintfptr(stdout, "%d\n", (*f)(24)); return 0; } -- cgit v1.3.1