summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/c_funloc_tests_4_driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/c_funloc_tests_4_driver.c')
-rw-r--r--gcc/testsuite/gfortran.dg/c_funloc_tests_4_driver.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/c_funloc_tests_4_driver.c b/gcc/testsuite/gfortran.dg/c_funloc_tests_4_driver.c
new file mode 100644
index 000000000..17e4e6501
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c_funloc_tests_4_driver.c
@@ -0,0 +1,39 @@
+#include <stdio.h>
+
+void sub0(void);
+void c_sub0(void (*sub)(void));
+void c_sub1(int (*func)(int));
+
+extern void abort(void);
+
+int main(int argc, char **argv)
+{
+ printf("hello from C main\n");
+
+ sub0();
+ return 0;
+}
+
+void c_sub0(void (*sub)(void))
+{
+ printf("hello from c_sub0\n");
+ sub();
+
+ return;
+}
+
+void c_sub1(int (*func)(int))
+{
+ int retval;
+
+ printf("hello from c_sub1\n");
+
+ retval = func(10);
+ if(retval != 10)
+ {
+ fprintf(stderr, "Fortran function did not return expected value!\n");
+ abort();
+ }
+
+ return;
+}