Debian Codegraph @

gcc/testsuite/gfortran.dg/c-interop/fc-out-descriptor-5-c.c

raw
1 #include <stdlib.h>
2 #include <string.h>
3
4 #include <ISO_Fortran_binding.h>
5 #include "dump-descriptors.h"
6
7 extern void ctest (CFI_cdesc_t *a);
8
9 void
10 ctest (CFI_cdesc_t *a)
11 {
12 /* Dump the descriptor contents to test that we can access the fields
13 correctly, etc. */
14 dump_CFI_cdesc_t (a);
15
16 /* The character object passed as the argument was declared on the
17 Fortran side as character(len=26) :: aa
18 Make sure that matches what's in the descriptor. */
19 if (!a->base_addr)
20 abort ();
21 if (a->elem_len != 26)
22 abort ();
23 if (a->rank != 0)
24 abort ();
25 if (a->type != CFI_type_char)
26 abort ();
27 if (a->attribute != CFI_attribute_other)
28 abort ();
29 strncpy ((char *)a->base_addr, "0123456789", 10);
30 }