1 #include <stdlib.h>
2
3 #include <ISO_Fortran_binding.h>
4 #include "dump-descriptors.h"
5
6 extern void ctest (CFI_cdesc_t *a, int n);
7 extern void ftest (CFI_cdesc_t *a, int n);
8
9 void
10 ctest (CFI_cdesc_t *a, int n)
11 {
12 int i;
13 CFI_index_t s[1];
14
15 /* Dump the descriptor contents to test that we can access the fields
16 correctly, etc. */
17 dump_CFI_cdesc_t (a);
18
19 if (!a->base_addr)
20 abort ();
21 if (a->elem_len != sizeof(int))
22 abort ();
23 if (a->rank != 1)
24 abort ();
25 if (a->type != CFI_type_int)
26 abort ();
27 if (a->attribute != CFI_attribute_other)
28 abort ();
29 if (a->dim[0].lower_bound != 0)
30 abort ();
31 if (a->dim[0].extent != -1)
32 abort ();
33
34 ftest (a, n);
35
36 for (i = 0; i < n; i++)
37 {
38 s[0] = i;
39 if (*((int *)CFI_address (a, s)) != i + 1)
40 abort ();
41 }
42 }