Fix gawk miscompile

See testcase.  Function pointer use was hosed when the destination
function wasn't also called normally by the program.
This commit is contained in:
Michael Matz
2016-12-18 05:18:19 +01:00
parent cd9514abc4
commit 77d7ea04ac
5 changed files with 56 additions and 27 deletions

View File

@ -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;
}