1 /* Test fix for PR89385. */
3 /* Contributed by Reinhold Bader <Bader@lrz.de> */
7 #include <ISO_Fortran_binding.h>
15 void Psub(CFI_cdesc_t
*this, CFI_cdesc_t
*that
, int *ierr
) {
20 if (this->elem_len
!= sizeof(float)) {
21 printf("FAIL: this->elem_len %i\n",(int) this->elem_len
);
24 if (this->type
!= CFI_type_float
) {
25 printf("FAIL: this->type\n");
28 if (this->rank
!= 2) {
29 printf("FAIL: this->rank %i\n",this->rank
);
32 if (this->attribute
!= CFI_attribute_allocatable
) {
33 printf("FAIL: this->attribute\n");
37 if (dim
[0].lower_bound
!= 3 || dim
[0].extent
!= 4) {
38 printf("FAIL: dim[0] %d %d\n", dim
[0].lower_bound
, dim
[0].extent
);
41 if (dim
[1].lower_bound
!= 1 || dim
[1].extent
!= 5) {
42 printf("FAIL: dim[1] %d %d\n", dim
[1].lower_bound
, dim
[1].extent
);
46 if (that
->elem_len
!= sizeof(cstruct
)) {
47 printf("FAIL: that->elem_len\n");
50 if (that
->type
!= CFI_type_struct
) {
51 printf("FAIL: that->type %d %d\n", that
->type
, CFI_type_struct
);
54 if (that
->rank
!= 1) {
55 printf("FAIL: that->rank\n");
58 if (that
->attribute
!= CFI_attribute_allocatable
) {
59 printf("FAIL: that->attribute\n");
63 if (dim
[0].lower_bound
!= 1 || dim
[0].extent
!= 1) {
64 printf("FAIL: dim[0] %d %d\n" , dim
[0].lower_bound
, dim
[0].extent
);
67 cu
= (cstruct
*) ((CFI_cdesc_t
*) that
)->base_addr
;
68 if (cu
->i
!= 4 || fabs(cu
->r
[1] - 2.2) > 1.0e-6) {
69 printf("FAIL: value of that %i %f %f\n",cu
->i
,cu
->r
[1],cu
->r
[2]);
73 ct
= (float *) ((CFI_cdesc_t
*) this)->base_addr
;
74 if ( fabs(ct
[5] + 2.0) > 1.0e-6) {
75 printf("FAIL: value of this %f\n",ct
[5]);