aboutsummaryrefslogtreecommitdiff
path: root/tests/tests2/42_function_pointer.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2016-12-18 05:18:19 +0100
committerMichael Matz <matz@suse.de>2016-12-18 05:20:14 +0100
commit77d7ea04acb56f839031993c102366e30cad5c25 (patch)
tree0e31c78f0462ff78b43a5bcb488984fb3ed4d5e3 /tests/tests2/42_function_pointer.c
parentcd9514abc4f4d7d90acce108b98ea2af58a1b80a (diff)
downloadtinycc-77d7ea04acb56f839031993c102366e30cad5c25.tar.gz
tinycc-77d7ea04acb56f839031993c102366e30cad5c25.tar.bz2
Fix gawk miscompile
See testcase. Function pointer use was hosed when the destination function wasn't also called normally by the program.
Diffstat (limited to 'tests/tests2/42_function_pointer.c')
-rw-r--r--tests/tests2/42_function_pointer.c6
1 files changed, 5 insertions, 1 deletions
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;
}