annotate gcc/testsuite/gfortran.dg/c_funloc_tests_3_funcs.c @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* These functions support the test case c_funloc_tests_3. */
kono
parents:
diff changeset
2 #include <stdlib.h>
kono
parents:
diff changeset
3 #include <stdio.h>
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 int printIntC(int i)
kono
parents:
diff changeset
6 {
kono
parents:
diff changeset
7 return 3*i;
kono
parents:
diff changeset
8 }
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 int (*returnFunc(void))(int)
kono
parents:
diff changeset
11 {
kono
parents:
diff changeset
12 return &printIntC;
kono
parents:
diff changeset
13 }
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 void callFunc(int(*func)(int), int pass, int compare)
kono
parents:
diff changeset
16 {
kono
parents:
diff changeset
17 int result = (*func)(pass);
kono
parents:
diff changeset
18 if(result != compare)
kono
parents:
diff changeset
19 {
kono
parents:
diff changeset
20 printf("FAILED: Got %d, expected %d\n", result, compare);
kono
parents:
diff changeset
21 abort();
kono
parents:
diff changeset
22 }
kono
parents:
diff changeset
23 else
kono
parents:
diff changeset
24 printf("SUCCESS: Got %d, expected %d\n", result, compare);
kono
parents:
diff changeset
25 }