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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141915
138bc75d-0d04-0410-961f-
82ee72b054a4
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
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
--- /dev/null
+! { 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" } }
+