]> gcc.gnu.org Git - gcc.git/commitdiff
re PR fortran/44207 (ICE with ALLOCATABLE components and SOURCE)
authorJanus Weil <janus@gcc.gnu.org>
Fri, 11 Jun 2010 01:42:38 +0000 (03:42 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Fri, 11 Jun 2010 01:42:38 +0000 (03:42 +0200)
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

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/allocate_alloc_opt_7.f90 [new file with mode: 0644]

index 5988845a40efd2436d70681fbfe97daccdbe6eef..6cf60ee47b2dd58c8dd1f6780dd70724edfa2418 100644 (file)
@@ -1,3 +1,8 @@
+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
index 226c2f9197bcc9b44d003390f4309eaabe4fc49c..4b4c50559c32d6429f5640ccf375328dd3e1cda3 100644 (file)
@@ -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)
index f5ca670d60bfb69e5de4f5dc71dbc9b1a2aa8dcf..b2ffe20bc55bbe218bb3d7749f36c2f83ba6567f 100644 (file)
@@ -1,3 +1,8 @@
+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
diff --git a/gcc/testsuite/gfortran.dg/allocate_alloc_opt_7.f90 b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_7.f90
new file mode 100644 (file)
index 0000000..e77f6b7
--- /dev/null
@@ -0,0 +1,18 @@
+! { 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
This page took 0.101653 seconds and 5 git commands to generate.