Type Type::get_array_to_with_region(Nodecl::NodeclBase lower_bound, Nodecl::NodeclBase upper_bound, Nodecl::NodeclBase region_lower_bound, Nodecl::NodeclBase region_upper_bound, Scope sc) { type_t* result_type = this->_type_info; const decl_context_t* decl_context = sc.get_decl_context(); // Make the range of the region Nodecl::NodeclBase range = Nodecl::Range::make( region_lower_bound, region_upper_bound, const_value_to_nodecl(const_value_get_one(4, 1)), region_lower_bound.get_type(), region_lower_bound.get_locus()); type_t* array_to = get_array_type_bounds_with_regions( result_type, lower_bound.get_internal_nodecl(), upper_bound.get_internal_nodecl(), decl_context, range.get_internal_nodecl(), decl_context); return array_to; }
type_t* fortran_rebuild_array_type(type_t* rank0_type, type_t* array_type) { rank0_type = no_ref(rank0_type); ERROR_CONDITION(!fortran_is_scalar_type(rank0_type) && !fortran_is_character_type(rank0_type), "Invalid rank0 type", 0); if (!fortran_is_array_type(array_type)) { return rank0_type; } else { type_t* t = fortran_rebuild_array_type(rank0_type, array_type_get_element_type(array_type)); if (array_type_has_region(array_type)) { return get_array_type_bounds_with_regions(t, array_type_get_array_lower_bound(array_type), array_type_get_array_upper_bound(array_type), array_type_get_array_size_expr_context(array_type), // Why did we do this so difficult? nodecl_make_range( nodecl_shallow_copy(array_type_get_region_lower_bound(array_type)), nodecl_shallow_copy(array_type_get_region_upper_bound(array_type)), nodecl_shallow_copy(array_type_get_region_stride(array_type)), fortran_get_default_integer_type(), make_locus("", 0, 0)), array_type_get_region_size_expr_context(array_type) ); } else if (array_type_with_descriptor(array_type)) { return get_array_type_bounds_with_descriptor(t, array_type_get_array_lower_bound(array_type), array_type_get_array_upper_bound(array_type), array_type_get_array_size_expr_context(array_type)); } else { return get_array_type_bounds(t, array_type_get_array_lower_bound(array_type), array_type_get_array_upper_bound(array_type), array_type_get_array_size_expr_context(array_type)); } } }