------- Comment #7 from rguenth at gcc dot gnu dot org 2009-07-01 09:43 ------- tmp = build4 (ARRAY_RANGE_REF, TREE_TYPE (dest), dest, build_int_cst (gfc_array_index_type, 3), NULL_TREE, NULL_TREE);
to set the upper bound correctly you have to build a new array type instead of re-using TREE_TYPE (dest). The types TYPE_DOMAIN will specify the size of the slice. Thus, slice_type = build_array_type (TREE_TYPE (TREE_TYPE (dest)), build_index_type (build_int_cst (gfc_array_index_type, slice-size - 1))); Richard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40598