re PR fortran/55789 (Needless realloc with array constructor.)

2013-02-06 Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/55789
	* trans-array.c (trans_array_constructor): Remove condition
	'dynamic' = true if the loop ubound is a VAR_DECL.

2013-02-06 Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/55789
	* gfortran.dg/array_constructor_41.f90: New test.

From-SVN: r195815
This commit is contained in:
Paul Thomas 2013-02-06 20:20:08 +00:00
parent c362c6741d
commit d0c4e31020
4 changed files with 44 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2013-02-06 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55789
* trans-array.c (trans_array_constructor): Remove condition
'dynamic' = true if the loop ubound is a VAR_DECL.
2013-02-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/56008

View File

@ -2307,9 +2307,6 @@ trans_array_constructor (gfc_ss * ss, locus * where)
}
}
if (TREE_CODE (*loop_ubound0) == VAR_DECL)
dynamic = true;
gfc_trans_create_temp_array (&outer_loop->pre, &outer_loop->post, ss, type,
NULL_TREE, dynamic, true, false, where);

View File

@ -1,3 +1,8 @@
2013-02-06 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55789
* gfortran.dg/array_constructor_41.f90: New test.
2013-02-06 Janus Weil <janus@gcc.gnu.org>
PR fortran/55978

View File

@ -0,0 +1,33 @@
! { dg-do compile }
! { dg-options "-fdump-tree-original" }
! Test fix for PR55789
!
! Contributed by Joost VandVandole <Joost.VandeVondele@mat.ethz.ch>
!
MODULE M1
CONTAINS
SUBROUTINE cp_1d_i4_sort(arr)
INTEGER(kind=4), DIMENSION(:), &
INTENT(inout) :: arr
arr = (/ (i, i = 1, SIZE(arr)) /)
END SUBROUTINE
END MODULE M1
PROGRAM TEST
USE M1
INTEGER :: arr(1)
INTERFACE
SUBROUTINE mtrace() BIND(C,name="mtrace")
END SUBROUTINE
END INTERFACE
INTERFACE
SUBROUTINE muntrace() BIND(C,name="muntrace")
END SUBROUTINE
END INTERFACE
CALL mtrace()
CALL cp_1d_i4_sort(arr)
CALL muntrace()
END
! { dg-final { scan-tree-dump-times "realloc" 0 "original" } }
! { dg-final { cleanup-tree-dump "original" } }