Commit f315a6b4 by Daniel Kraft Committed by Daniel Kraft

re PR fortran/49885 (Segmentation fault when writing to an automatic character array)

2011-08-02  Daniel Kraft  <d@domob.eu>

	PR fortran/49885
	* trans-array.c (gfc_trans_auto_array_allocation): Change
	gfc_start_block to gfc_init_block to avoid spurious extra-scope.

2011-08-02  Daniel Kraft  <d@domob.eu>

	PR fortran/49885
	* gfortran.dg/auto_char_dummy_array_3.f90: New test.

From-SVN: r177211
parent 8f1594b2
2011-08-02 Daniel Kraft <d@domob.eu>
PR fortran/49885
* trans-array.c (gfc_trans_auto_array_allocation): Change
gfc_start_block to gfc_init_block to avoid spurious extra-scope.
2011-08-02 Tobias Burnus <burnus@net-b.de>
* trans-array.c (gfc_array_allocate): Pass token to
......
......@@ -4887,7 +4887,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym,
gcc_assert (GFC_ARRAY_TYPE_P (type));
onstack = TREE_CODE (type) != POINTER_TYPE;
gfc_start_block (&init);
gfc_init_block (&init);
/* Evaluate character string length. */
if (sym->ts.type == BT_CHARACTER
......
2011-08-02 Daniel Kraft <d@domob.eu>
PR fortran/49885
* gfortran.dg/auto_char_dummy_array_3.f90: New test.
2011-08-02 Kai Tietz <ktietz@redhat.com>
PR middle-end/49947
......
! { dg-do run }
! PR fortran/49885
! Check that character arrays with non-constant char-length are handled
! correctly.
! Contributed by Daniel Kraft <d@domob.eu>,
! based on original test case and variant by Tobias Burnus in comment 2.
PROGRAM main
IMPLICIT NONE
CALL s (10)
CONTAINS
SUBROUTINE s (nb)
INTEGER :: nb
CHARACTER(MAX (80, nb)) :: bad_rec(1)
bad_rec(1)(1:2) = 'abc'
IF (bad_rec(1)(1:2) /= 'ab') CALL abort ()
END SUBROUTINE s
END PROGRAM main
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