+2006-06-24 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ PR fortran/28081
+ * resolve.c (resolve_substring): Don't issue out-of-bounds
+ error messages when the range has zero size.
+
2006-06-24 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/23862
return FAILURE;
}
- if (compare_bound_int (ref->u.ss.start, 1) == CMP_LT)
+ if (compare_bound_int (ref->u.ss.start, 1) == CMP_LT
+ && (compare_bound (ref->u.ss.end, ref->u.ss.start) == CMP_EQ
+ || compare_bound (ref->u.ss.end, ref->u.ss.start) == CMP_GT))
{
gfc_error ("Substring start index at %L is less than one",
&ref->u.ss.start->where);
}
if (ref->u.ss.length != NULL
- && compare_bound (ref->u.ss.end, ref->u.ss.length->length) == CMP_GT)
+ && compare_bound (ref->u.ss.end, ref->u.ss.length->length) == CMP_GT
+ && (compare_bound (ref->u.ss.end, ref->u.ss.start) == CMP_EQ
+ || compare_bound (ref->u.ss.end, ref->u.ss.start) == CMP_GT))
{
- gfc_error ("Substring end index at %L is out of bounds",
+ gfc_error ("Substring end index at %L exceeds the string length",
&ref->u.ss.start->where);
return FAILURE;
}
+2006-06-24 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ PR fortran/28081
+ * gfortran.dg/substr_3.f: New test.
+ * gfortran.dg/equiv_2.f90: Update expected error message.
+
2006-06-24 Paul Thomas <pault@gcc.gnu.org>
PR fortran/28118