re PR fortran/57285 ([OOP] ICE on invalid: "gfc_array_dimen_size(): Bad dimension...
authorJanus Weil <janus@gcc.gnu.org>
Sat, 27 Jul 2013 12:55:59 +0000 (14:55 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Sat, 27 Jul 2013 12:55:59 +0000 (14:55 +0200)
2013-07-27  Janus Weil  <janus@gcc.gnu.org>

PR fortran/57285
* check.c (dim_rank_check): Re-enable this check for CLASS arrays.

2013-07-27  Janus Weil  <janus@gcc.gnu.org>

PR fortran/57285
* gfortran.dg/class_array_19.f90: New.

From-SVN: r201284

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

index 0723c6d..6b95a0d 100644 (file)
@@ -1,3 +1,8 @@
+2013-07-27  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/57285
+       * check.c (dim_rank_check): Re-enable this check for CLASS arrays.
+
 2013-07-25  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/57966
index 884dc43..758639e 100644 (file)
@@ -608,9 +608,6 @@ dim_rank_check (gfc_expr *dim, gfc_expr *array, int allow_assumed)
   if (dim->expr_type != EXPR_CONSTANT)
     return true;
 
-  if (array->ts.type == BT_CLASS)
-    return true;
-
   if (array->expr_type == EXPR_FUNCTION && array->value.function.isym
       && array->value.function.isym->id == GFC_ISYM_SPREAD)
     rank = array->rank + 1;
index b81fe8f..0940a39 100644 (file)
@@ -1,3 +1,8 @@
+2013-07-27  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/57285
+       * gfortran.dg/class_array_19.f90: New.
+
 2013-07-27  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc.dg/vect/pr57705.c: Adjust for a !vect_pack_trunc target.
diff --git a/gcc/testsuite/gfortran.dg/class_array_19.f90 b/gcc/testsuite/gfortran.dg/class_array_19.f90
new file mode 100644 (file)
index 0000000..0b28db1
--- /dev/null
@@ -0,0 +1,14 @@
+! { dg-do compile }
+!
+! PR 57285: [OOP] ICE on invalid: "gfc_array_dimen_size(): Bad dimension" due to SIZE intrinsic with invalid dim on CLASS dummy
+!
+! Contributed by Lorenz Hüdepohl <bugs@stellardeath.org>
+
+  type type_t
+  end type
+contains
+  subroutine foo(a)
+    class(type_t), intent(in) :: a(:)
+    type(type_t) :: c(size(a,dim=2))   ! { dg-error "is not a valid dimension index" }
+  end subroutine
+end