@@ -414,11 +414,14 @@ int main (void)
414
414
ind = CFI_establish ((CFI_cdesc_t * ) & test6 , NULL , attribute , type [i ],
415
415
elem_len , rank , extents );
416
416
ind = CFI_allocate ((CFI_cdesc_t * ) & test6 , lower , upper , base_type_size );
417
- ind = CFI_deallocate ((CFI_cdesc_t * ) & test6 );
418
- if (ind != CFI_INVALID_ATTRIBUTE && test6 .base_addr != NULL )
417
+ if (ind == CFI_SUCCESS )
419
418
{
420
- printf ("CFI_deallocate: failed to deallocate memory.\n" );
421
- return 1 ;
419
+ ind = CFI_deallocate ((CFI_cdesc_t * ) & test6 );
420
+ if (ind != CFI_INVALID_ATTRIBUTE && test6 .base_addr != NULL )
421
+ {
422
+ printf ("CFI_deallocate: failed to deallocate memory.\n" );
423
+ return 1 ;
424
+ }
422
425
}
423
426
}
424
427
@@ -459,6 +462,10 @@ int main (void)
459
462
elem_len , rank , extents );
460
463
tmp_ind = CFI_allocate ((CFI_cdesc_t * ) & test7 , lower , upper ,
461
464
base_type_size );
465
+ if (tmp_ind != CFI_SUCCESS )
466
+ {
467
+ goto next_attribute4 ;
468
+ }
462
469
ind = CFI_is_contiguous ((CFI_cdesc_t * ) & test7 );
463
470
if (ind != CFI_INVALID_RANK && rank == 0 &&
464
471
tmp_ind != CFI_INVALID_ATTRIBUTE )
@@ -474,6 +481,7 @@ int main (void)
474
481
return 1 ;
475
482
}
476
483
}
484
+ next_attribute4 :;
477
485
}
478
486
479
487
/* Test CFI_address. */
@@ -875,7 +883,7 @@ int main (void)
875
883
CFI_attribute_other , type [i ], elem_len , rank ,
876
884
NULL );
877
885
ind = CFI_allocate ((CFI_cdesc_t * ) & source , lower , upper , elem_len );
878
- if (ind == CFI_ERROR_MEM_ALLOCATION )
886
+ if (ind != CFI_SUCCESS )
879
887
{
880
888
goto next_type2 ;
881
889
}
@@ -1036,44 +1044,48 @@ int main (void)
1036
1044
ind = CFI_establish ((CFI_cdesc_t * ) & section , NULL , CFI_attribute_other ,
1037
1045
type [3 ], elem_len , rank , NULL );
1038
1046
ind = CFI_allocate ((CFI_cdesc_t * ) & source , lower , upper , elem_len );
1039
- for (int r = 0 ; r < rank ; r ++ )
1040
- {
1041
- lower [r ] = rank - r - 3 ;
1042
- strides [r ] = r + 1 ;
1043
- upper [r ] = lower [r ] + extents [r ] - 3 ;
1044
- }
1045
- ind = CFI_section ((CFI_cdesc_t * ) & section , NULL , lower , upper , strides );
1046
- if (ind != CFI_INVALID_DESCRIPTOR )
1047
- {
1048
- printf ("CFI_section: failed to detect that source is NULL.\n" );
1049
- return 1 ;
1050
- }
1051
- ind = CFI_section (NULL , (CFI_cdesc_t * ) & source , lower , upper , strides );
1052
- if (ind != CFI_INVALID_DESCRIPTOR )
1047
+ if (ind == CFI_SUCCESS )
1053
1048
{
1054
- printf ("CFI_section: failed to detect that section is NULL.\n" );
1055
- return 1 ;
1056
- }
1057
- ind =
1058
- CFI_establish ((CFI_cdesc_t * ) & section , NULL , CFI_attribute_allocatable ,
1059
- type [3 ], elem_len , rank , NULL );
1060
- ind = CFI_section ((CFI_cdesc_t * ) & section , (CFI_cdesc_t * ) & source , lower ,
1061
- upper , strides );
1062
- if (ind != CFI_INVALID_ATTRIBUTE )
1063
- {
1064
- printf ("CFI_section: failed to detect invalid attribute.\n" );
1065
- return 1 ;
1066
- }
1067
- ind = CFI_establish ((CFI_cdesc_t * ) & section , NULL , CFI_attribute_other ,
1068
- type [3 ], elem_len , rank , NULL );
1069
- ind = CFI_deallocate ((CFI_cdesc_t * ) & source );
1070
- ind = CFI_section ((CFI_cdesc_t * ) & section , (CFI_cdesc_t * ) & source , lower ,
1071
- upper , strides );
1072
- if (ind != CFI_ERROR_BASE_ADDR_NULL )
1073
- {
1074
- printf ("CFI_section: failed to detect that the base address is NULL.\n" );
1075
- return 1 ;
1049
+ for (int r = 0 ; r < rank ; r ++ )
1050
+ {
1051
+ lower [r ] = rank - r - 3 ;
1052
+ strides [r ] = r + 1 ;
1053
+ upper [r ] = lower [r ] + extents [r ] - 3 ;
1054
+ }
1055
+ ind = CFI_section ((CFI_cdesc_t * ) & section , NULL , lower , upper , strides );
1056
+ if (ind != CFI_INVALID_DESCRIPTOR )
1057
+ {
1058
+ printf ("CFI_section: failed to detect that source is NULL.\n" );
1059
+ return 1 ;
1060
+ }
1061
+ ind = CFI_section (NULL , (CFI_cdesc_t * ) & source , lower , upper , strides );
1062
+ if (ind != CFI_INVALID_DESCRIPTOR )
1063
+ {
1064
+ printf ("CFI_section: failed to detect that section is NULL.\n" );
1065
+ return 1 ;
1066
+ }
1067
+ ind =
1068
+ CFI_establish ((CFI_cdesc_t * ) & section , NULL , CFI_attribute_allocatable ,
1069
+ type [3 ], elem_len , rank , NULL );
1070
+ ind = CFI_section ((CFI_cdesc_t * ) & section , (CFI_cdesc_t * ) & source , lower ,
1071
+ upper , strides );
1072
+ if (ind != CFI_INVALID_ATTRIBUTE )
1073
+ {
1074
+ printf ("CFI_section: failed to detect invalid attribute.\n" );
1075
+ return 1 ;
1076
+ }
1077
+ ind = CFI_establish ((CFI_cdesc_t * ) & section , NULL , CFI_attribute_other ,
1078
+ type [3 ], elem_len , rank , NULL );
1079
+ ind = CFI_deallocate ((CFI_cdesc_t * ) & source );
1080
+ ind = CFI_section ((CFI_cdesc_t * ) & section , (CFI_cdesc_t * ) & source , lower ,
1081
+ upper , strides );
1082
+ if (ind != CFI_ERROR_BASE_ADDR_NULL )
1083
+ {
1084
+ printf ("CFI_section: failed to detect that the base address is NULL.\n" );
1085
+ return 1 ;
1086
+ }
1076
1087
}
1088
+
1077
1089
CFI_CDESC_T (0 ) section2 , source2 ;
1078
1090
ind = CFI_establish ((CFI_cdesc_t * ) & source2 , & ind , CFI_attribute_other ,
1079
1091
type [3 ], 0 , 0 , NULL );
@@ -1086,33 +1098,37 @@ int main (void)
1086
1098
printf ("CFI_section: failed to detect invalid rank.\n" );
1087
1099
return 1 ;
1088
1100
}
1101
+
1089
1102
ind = CFI_establish ((CFI_cdesc_t * ) & source , NULL , CFI_attribute_allocatable ,
1090
1103
type [3 ], 0 , rank , extents );
1091
1104
ind = CFI_establish ((CFI_cdesc_t * ) & section , NULL , CFI_attribute_other ,
1092
1105
type [6 ], 0 , rank , NULL );
1093
1106
ind = CFI_allocate ((CFI_cdesc_t * ) & source , lower , upper , elem_len );
1094
- for (int r = 0 ; r < rank ; r ++ )
1095
- {
1096
- lower [r ] = rank - r - 3 ;
1097
- strides [r ] = r + 1 ;
1098
- upper [r ] = lower [r ] + extents [r ] - 3 ;
1099
- }
1100
- ind = CFI_section ((CFI_cdesc_t * ) & section , (CFI_cdesc_t * ) & source , lower ,
1101
- upper , strides );
1102
- if (ind != CFI_INVALID_ELEM_LEN )
1107
+ if (ind == CFI_SUCCESS )
1103
1108
{
1104
- printf ("CFI_section: failed to detect incompatible element lengths "
1105
- "between source and section.\n" );
1106
- return 1 ;
1107
- }
1108
- ind = CFI_establish ((CFI_cdesc_t * ) & section , NULL , CFI_attribute_other ,
1109
- CFI_type_long , 0 , rank , NULL );
1110
- ind = CFI_section ((CFI_cdesc_t * ) & section , (CFI_cdesc_t * ) & source , lower ,
1111
- upper , strides );
1112
- if (ind != CFI_INVALID_TYPE )
1113
- {
1114
- printf ("CFI_section: failed to detect invalid type.\n" );
1115
- return 1 ;
1109
+ for (int r = 0 ; r < rank ; r ++ )
1110
+ {
1111
+ lower [r ] = rank - r - 3 ;
1112
+ strides [r ] = r + 1 ;
1113
+ upper [r ] = lower [r ] + extents [r ] - 3 ;
1114
+ }
1115
+ ind = CFI_section ((CFI_cdesc_t * ) & section , (CFI_cdesc_t * ) & source , lower ,
1116
+ upper , strides );
1117
+ if (ind != CFI_INVALID_ELEM_LEN )
1118
+ {
1119
+ printf ("CFI_section: failed to detect incompatible element lengths "
1120
+ "between source and section.\n" );
1121
+ return 1 ;
1122
+ }
1123
+ ind = CFI_establish ((CFI_cdesc_t * ) & section , NULL , CFI_attribute_other ,
1124
+ CFI_type_long , 0 , rank , NULL );
1125
+ ind = CFI_section ((CFI_cdesc_t * ) & section , (CFI_cdesc_t * ) & source , lower ,
1126
+ upper , strides );
1127
+ if (ind != CFI_INVALID_TYPE )
1128
+ {
1129
+ printf ("CFI_section: failed to detect invalid type.\n" );
1130
+ return 1 ;
1131
+ }
1116
1132
}
1117
1133
1118
1134
for (int i = 1 ; i < CFI_MAX_RANK ; i ++ )
@@ -1151,7 +1167,7 @@ int main (void)
1151
1167
CFI_establish ((CFI_cdesc_t * ) & source , NULL ,
1152
1168
CFI_attribute_allocatable , type [3 ], 0 , rank , extents );
1153
1169
ind = CFI_allocate ((CFI_cdesc_t * ) & source , lower , upper , elem_len );
1154
- if (ind == CFI_ERROR_MEM_ALLOCATION )
1170
+ if (ind != CFI_SUCCESS )
1155
1171
{
1156
1172
continue ;
1157
1173
}
@@ -1252,13 +1268,15 @@ int main (void)
1252
1268
ind = CFI_establish ((CFI_cdesc_t * ) & section3 , NULL , CFI_attribute_other ,
1253
1269
type [3 ], 0 , rank , NULL );
1254
1270
ind = CFI_allocate ((CFI_cdesc_t * ) & source3 , lower , upper , elem_len );
1255
-
1256
- ind = CFI_section ((CFI_cdesc_t * ) & section3 , (CFI_cdesc_t * ) & source3 , upper ,
1257
- lower , strides );
1258
- if (ind != CFI_SUCCESS && ind != CFI_INVALID_STRIDE )
1271
+ if (ind == CFI_SUCCESS )
1259
1272
{
1260
- printf ("CFI_section: failed to detect invalid stride.\n" );
1261
- return 1 ;
1273
+ ind = CFI_section ((CFI_cdesc_t * ) & section3 , (CFI_cdesc_t * ) & source3 ,
1274
+ upper , lower , strides );
1275
+ if (ind != CFI_SUCCESS && ind != CFI_INVALID_STRIDE )
1276
+ {
1277
+ printf ("CFI_section: failed to detect invalid stride.\n" );
1278
+ return 1 ;
1279
+ }
1262
1280
}
1263
1281
1264
1282
/* CFI_select_part */
0 commit comments