/* Test the fix for PR94331. */ #include #include #include #include bool c_vrfy (const CFI_cdesc_t *restrict); bool check_bounds(const CFI_cdesc_t*restrict, const int, const int); bool c_vrfy (const CFI_cdesc_t *restrict auxp) { CFI_index_t i, lb, ub, ex; int *ip = NULL; assert (auxp); assert (auxp->base_addr); lb = auxp->dim[0].lower_bound; ex = auxp->dim[0].extent; ub = ex + lb - 1; ip = (int*)auxp->base_addr; for (i=0; ielem_len; assert (auxp->rank==1); assert (auxp->type==CFI_type_int); assert (auxp->dim[0].sm>0); assert ((size_t)auxp->dim[0].sm==el); if (auxp->dim[0].extent==ex && auxp->dim[0].lower_bound==lb) { switch(auxp->attribute) { case CFI_attribute_pointer: case CFI_attribute_allocatable: if (!c_vrfy (auxp)) break; is_ok = true; break; case CFI_attribute_other: if (!c_vrfy (auxp)) break; is_ok = (lb==0); break; default: assert (false); break; } } return is_ok; }