Commit 66051b60 by Janus Weil

re PR fortran/44207 (ICE with ALLOCATABLE components and SOURCE)

2010-06-10  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/44207
	* resolve.c (conformable_arrays): Handle allocatable components.


2010-06-10  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/44207
	* gfortran.dg/allocate_alloc_opt_7.f90: New test.

From-SVN: r160589
parent 328f6bf1
2010-06-10 Janus Weil <janus@gcc.gnu.org>
PR fortran/44207
* resolve.c (conformable_arrays): Handle allocatable components.
2010-06-10 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/38273
......
......@@ -6146,8 +6146,11 @@ gfc_expr_to_initialize (gfc_expr *e)
static gfc_try
conformable_arrays (gfc_expr *e1, gfc_expr *e2)
{
gfc_ref *tail;
for (tail = e2->ref; tail && tail->next; tail = tail->next);
/* First compare rank. */
if (e2->ref && e1->rank != e2->ref->u.ar.as->rank)
if (tail && e1->rank != tail->u.ar.as->rank)
{
gfc_error ("Source-expr at %L must be scalar or have the "
"same rank as the allocate-object at %L",
......@@ -6164,15 +6167,15 @@ conformable_arrays (gfc_expr *e1, gfc_expr *e2)
for (i = 0; i < e1->rank; i++)
{
if (e2->ref->u.ar.end[i])
if (tail->u.ar.end[i])
{
mpz_set (s, e2->ref->u.ar.end[i]->value.integer);
mpz_sub (s, s, e2->ref->u.ar.start[i]->value.integer);
mpz_set (s, tail->u.ar.end[i]->value.integer);
mpz_sub (s, s, tail->u.ar.start[i]->value.integer);
mpz_add_ui (s, s, 1);
}
else
{
mpz_set (s, e2->ref->u.ar.start[i]->value.integer);
mpz_set (s, tail->u.ar.start[i]->value.integer);
}
if (mpz_cmp (e1->shape[i], s) != 0)
......
2010-06-10 Janus Weil <janus@gcc.gnu.org>
PR fortran/44207
* gfortran.dg/allocate_alloc_opt_7.f90: New test.
2010-06-10 Daniel Franke <franke.daniel@gmail.com>
PR fortran/44457
......
! { dg-do compile }
!
! PR 44207: ICE with ALLOCATABLE components and SOURCE
!
! Contributed by Hans-Werner Boschmann <boschmann@tp1.physik.uni-siegen.de>
program ice_prog
type::ice_type
integer,dimension(:),allocatable::list
end type ice_type
type(ice_type)::this
integer::dim=10,i
allocate(this%list(dim),source=[(i,i=1,dim)])
end program ice_prog
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