This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
PR fortran/48876 * expr.c (gfc_simplify_expr): If end of a string is less than zero, set it to zero.
PR fortran/48876 * gfortran.dg/string_5.f90: New test.
Index: expr.c =================================================================== --- expr.c (Revision 176933) +++ expr.c (Arbeitskopie) @@ -1839,6 +1839,9 @@ gfc_simplify_expr (gfc_expr *p, int type) if (p->ref && p->ref->u.ss.end) gfc_extract_int (p->ref->u.ss.end, &end); + if (end < 0) + end = 0; + s = gfc_get_wide_string (end - start + 2); memcpy (s, p->value.character.string + start, (end - start) * sizeof (gfc_char_t));
Attachment:
string_5.f90
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |