+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
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",
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)
--- /dev/null
+! { 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