]>
gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/gfortran.dg/ISO_Fortran_binding_16.c
50b92ec069c931fbbcdce54451660832c5e1dffe
1 /* Test the fix for PR92142. */
3 #include "ISO_Fortran_binding.h"
7 int c_setpointer(CFI_cdesc_t
*);
9 int c_setpointer(CFI_cdesc_t
*ip
)
11 CFI_cdesc_t
*yp
= NULL
;
12 void *auxp
= ip
->base_addr
;
16 /* Setting up the pointer */
18 yp
= malloc(sizeof(*ip
));
19 if (yp
== NULL
) return ierr
;
20 status
= CFI_establish(yp
, NULL
, CFI_attribute_pointer
, ip
->type
, ip
->elem_len
, ip
->rank
, NULL
);
21 if (status
!= CFI_SUCCESS
) return ierr
;
22 if (yp
->attribute
!= CFI_attribute_pointer
) return ierr
;
23 /* Set the pointer to ip */
25 status
= CFI_setpointer(yp
, ip
, NULL
);
26 if (status
!= CFI_SUCCESS
) return ierr
;
27 if (yp
->attribute
!= CFI_attribute_pointer
) return ierr
;
28 /* Set the pointer to NULL */
30 status
= CFI_setpointer(yp
, NULL
, NULL
);
31 if (status
!= CFI_SUCCESS
) return ierr
;
32 if (yp
->attribute
!= CFI_attribute_pointer
) return ierr
;
33 /* "Set" the ip variable to yp (should not be possible) */
35 status
= CFI_setpointer(ip
, yp
, NULL
);
36 if (status
!= CFI_INVALID_ATTRIBUTE
) return ierr
;
37 if (ip
->attribute
!= CFI_attribute_other
) return ierr
;
38 if (ip
->base_addr
!= auxp
) return ierr
;
This page took 0.038549 seconds and 4 git commands to generate.