(root)/
gcc-13.2.0/
gcc/
testsuite/
gfortran.dg/
c-interop/
fc-descriptor-9-c.c
       1  /* 8.3.1: ISO_Fortran_binding.h may be included more than once.  */
       2  
       3  #include <stdlib.h>
       4  
       5  #include <ISO_Fortran_binding.h>
       6  #include "dump-descriptors.h"
       7  
       8  extern void ctest (CFI_cdesc_t *a);
       9  
      10  struct descriptor_fixed_part {
      11    void *base_addr;
      12    size_t elem_len;
      13    int version;
      14  };
      15  
      16  void
      17  ctest (CFI_cdesc_t *a)
      18  {
      19    struct descriptor_fixed_part *f = (struct descriptor_fixed_part *) a;
      20  
      21    /* Dump the descriptor contents to test that we can access the fields
      22       correctly, etc.  */
      23    dump_CFI_cdesc_t (a);
      24  
      25    /* The first three members of the structure shall be base_addr,
      26       elem_len, and version in that order.  */
      27    if (&(a->base_addr) != &(f->base_addr))
      28      abort ();
      29    if (&(a->elem_len) != &(f->elem_len))
      30      abort ();
      31    if (&(a->version) != &(f->version))
      32      abort ();
      33  
      34    /* The final member shall be dim, with the other members after version
      35       and before dim in any order.  */
      36    if ((void *)&(a->rank) >= (void *)a->dim)
      37      abort ();
      38    if ((void *)&(a->type) >= (void *)a->dim)
      39      abort ();
      40    if ((void *)&(a->attribute) >= (void *)a->dim)
      41      abort ();
      42  }