]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/44962 ([OOP] ICE with specification expression SIZE(<CLASS>))
authorJanus Weil <janus@gcc.gnu.org>
Thu, 29 Jul 2010 20:58:57 +0000 (22:58 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Thu, 29 Jul 2010 20:58:57 +0000 (22:58 +0200)
2010-07-29  Janus Weil  <janus@gcc.gnu.org>

PR fortran/44962
* resolve.c (resolve_fl_derived): Call gfc_resolve_array_spec.

2010-07-29  Janus Weil  <janus@gcc.gnu.org>

PR fortran/44962
* gfortran.dg/typebound_proc_17.f03: New.

From-SVN: r162695

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

index f22ed116f2980a47b87087b168c3e2b6d2ca6aad..ff7549c720109e93ffa56ecb96ad2960a2cfd11c 100644 (file)
@@ -1,3 +1,8 @@
+2010-07-29  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/44962
+       * resolve.c (resolve_fl_derived): Call gfc_resolve_array_spec.
+
 2010-07-29  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/45004
index dab533d8242264f4725dc872bd4e40ae34b01256..55cbaf0f0711b1dfecf461885526d252708be028 100644 (file)
@@ -10813,7 +10813,6 @@ resolve_fl_derived (gfc_symbol *sym)
 {
   gfc_symbol* super_type;
   gfc_component *c;
-  int i;
 
   super_type = gfc_get_derived_super_type (sym);
   
@@ -11169,25 +11168,10 @@ resolve_fl_derived (gfc_symbol *sym)
            && sym != c->ts.u.derived)
        add_dt_to_dt_list (c->ts.u.derived);
 
-      if (c->attr.pointer || c->attr.proc_pointer || c->attr.allocatable
-         || c->as == NULL)
-       continue;
-
-      for (i = 0; i < c->as->rank; i++)
-       {
-         if (c->as->lower[i] == NULL
-             || (resolve_index_expr (c->as->lower[i]) == FAILURE)
-             || !gfc_is_constant_expr (c->as->lower[i])
-             || c->as->upper[i] == NULL
-             || (resolve_index_expr (c->as->upper[i]) == FAILURE)
-             || !gfc_is_constant_expr (c->as->upper[i]))
-           {
-             gfc_error ("Component '%s' of '%s' at %L must have "
-                        "constant array bounds",
-                        c->name, sym->name, &c->loc);
-             return FAILURE;
-           }
-       }
+      if (gfc_resolve_array_spec (c->as, !(c->attr.pointer
+                                          || c->attr.proc_pointer
+                                          || c->attr.allocatable)) == FAILURE)
+       return FAILURE;
     }
 
   /* Resolve the type-bound procedures.  */
index 060b87976b17010b1c5387857f0025f4f4b3ab3c..76f8a3475865da6b94f47ba87af78de429436240 100644 (file)
@@ -1,3 +1,8 @@
+2010-07-29  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/44962
+       * gfortran.dg/typebound_proc_17.f03: New.
+
 2010-07-29  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/45004
diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_17.f03 b/gcc/testsuite/gfortran.dg/typebound_proc_17.f03
new file mode 100644 (file)
index 0000000..5c1a1c3
--- /dev/null
@@ -0,0 +1,26 @@
+! { dg-do compile }
+!
+! PR 44962: [OOP] ICE with specification expression SIZE(<CLASS>)
+!
+! Contributed by Satish.BD <bdsatish@gmail.com>
+
+
+module array
+
+type :: t_array
+  real, dimension(10) :: coeff
+contains
+  procedure :: get_coeff
+end type t_array
+
+contains
+
+function get_coeff(self) result(coeff)
+  class(t_array), intent(in) :: self
+  real, dimension(size(self%coeff)) :: coeff !! The SIZE here carashes !!
+end function get_coeff
+
+end module array
+
+
+! { dg-final { cleanup-modules "array" } }