Commit b8bc0ff7 by Francois-Xavier Coudert Committed by François-Xavier Coudert

re PR fortran/50409 (SIGSEGV in gfc_simplify_expr)

	PR fortran/50409
	* expr.c (gfc_simplify_expr): Substrings can't have negative
	length.
	* gcc/testsuite/gfortran.dg/string_5.f90: Improve testcase.

From-SVN: r181181
parent 6ef98271
2011-11-08 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/50409
* expr.c (gfc_simplify_expr): Substrings can't have negative
length.
2011-11-08 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/50334
* invoke.texi (-finit-*): Document interaction with
-Wuninitialized.
......
......@@ -1853,8 +1853,8 @@ 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;
if (end < start)
end = start;
s = gfc_get_wide_string (end - start + 2);
memcpy (s, p->value.character.string + start,
......
2011-11-08 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/50409
* gcc/testsuite/gfortran.dg/string_5.f90: Improve testcase.
2011-10-23 Jason Merrill <jason@redhat.com>
PR c++/50835
......
! { dg-do compile }
! PR fortran/48876 - this used to segfault.
! Test case contributed by mhp77 (a) gmx.at.
program test
! PR fortran/48876 - this used to segfault.
! Test case contributed by mhp77 (a) gmx.at.
character :: string = "string"( : -1 )
! PR fortran/50409
character v(3)
v = (/ ('123'(i:1), i = 3, 1, -1) /)
print *, v
end program test
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment