Commit 22089905 by Paul Thomas

re PR fortran/38119 (character ICE in gfc_trans_create_temp_array)

2008-11-16  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/38119
	* trans-array.c (gfc_trans_create_temp_array): Set the
	loop->from to zero and the renormalisation of loop->to for all
	dimensions.

2008-11-16  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/38119
	* gfortran.dg/array_temporaries_3.f90: New test.

From-SVN: r141915
parent b800fd64
2008-11-16 Paul Thomas <pault@gcc.gnu.org>
PR fortran/38119
* trans-array.c (gfc_trans_create_temp_array): Set the
loop->from to zero and the renormalisation of loop->to for all
dimensions.
2008-11-16 Paul Thomas <pault@gcc.gnu.org>
PR fortran/37926
* trans-expr.c (gfc_free_interface_mapping): Null sym->formal
(gfc_add_interface_mapping): Copy the pointer to the formal
......
......@@ -644,18 +644,12 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post,
for (dim = 0; dim < info->dimen; dim++)
{
n = loop->order[dim];
if (n < loop->temp_dim)
gcc_assert (integer_zerop (loop->from[n]));
else
{
/* Callee allocated arrays may not have a known bound yet. */
if (loop->to[n])
loop->to[n] =
gfc_evaluate_now (fold_build2 (MINUS_EXPR,
gfc_array_index_type, loop->to[n],
loop->from[n]), pre);
loop->from[n] = gfc_index_zero_node;
}
/* Callee allocated arrays may not have a known bound yet. */
if (loop->to[n])
loop->to[n] = gfc_evaluate_now (fold_build2 (MINUS_EXPR,
gfc_array_index_type,
loop->to[n], loop->from[n]), pre);
loop->from[n] = gfc_index_zero_node;
info->delta[dim] = gfc_index_zero_node;
info->start[dim] = gfc_index_zero_node;
......
2008-11-16 Paul Thomas <pault@gcc.gnu.org>
PR fortran/38119
* gfortran.dg/array_temporaries_3.f90: New test.
2008-11-15 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/37294
......
! { dg-do run }
! PR38119 - The scalarizer got the loop size wrong
! for the temporary coming from the call to 'same'.
!
! Contributed by Mikael Morin <mikael.morin@tele2.fr>
! based on a program by Vivek Rao.
!
module bar
implicit none
character(len = 2) :: c(1)
contains
elemental function trim_append (xx,yy) result(xy)
character (len = *), intent(in) :: xx,yy
character (len = len (xx) + len (yy)) :: xy
xy = trim (xx) // trim (yy)
end function trim_append
function same(xx) result(yy)
character (len = *), intent(in) :: xx(:)
character (len = len (xx)) :: yy(size (xx))
yy = xx
end function same
subroutine xmain()
c = trim_append(["a"],same(["b"])) ! The problem occurred here
end subroutine xmain
end module bar
use bar
call xmain
if (c(1) .ne. "ab") call abort
end
! { dg-final { cleanup-modules "bar" } }
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