From 15fcaa3a11c523cea90962668b757d30714cc3e9 Mon Sep 17 00:00:00 2001 From: burnus Date: Wed, 23 May 2012 19:13:27 +0000 Subject: 2012-05-23 Tobias Burnus PR fortran/53389 * trans-array.c (gfc_add_loop_ss_code): Don't evaluate expression, if ss->is_alloc_lhs is set. 2012-05-23 Tobias Burnus PR fortran/53389 * gfortran.dg/realloc_on_assign_15.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@187810 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/trans-array.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/fortran/trans-array.c') diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index a4be6e7b165..d0d0900eb1d 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -2056,6 +2056,11 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript, gfc_se se; int n; + /* Don't evaluate the arguments for realloc_lhs_loop_for_fcn_call; otherwise, + arguments could get evaluated multiple times. */ + if (ss->is_alloc_lhs) + return; + /* TODO: This can generate bad code if there are ordering dependencies, e.g., a callee allocated function and an unknown size constructor. */ gcc_assert (ss != NULL); -- cgit v1.2.1