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
This commit is contained in:
parent
b800fd64b5
commit
2208990515
@ -1,3 +1,10 @@
|
||||
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
|
||||
|
@ -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;
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
31
gcc/testsuite/gfortran.dg/array_temporaries_3.f90
Normal file
31
gcc/testsuite/gfortran.dg/array_temporaries_3.f90
Normal file
@ -0,0 +1,31 @@
|
||||
! { 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" } }
|
||||
|
Loading…
Reference in New Issue
Block a user