Committed as obvious.

2019-12-11 Steven G. Kargl  <ka...@gcc.gnu.org>

        PR fortran/92897
        * array.c (gfc_set_array_spec):  Remove invalid assert() triggered
        by invalid Fortran code.
 
2019-12-11 Steven G. Kargl  <ka...@gcc.gnu.org>

        PR fortran/92897
        * gfortran.dg/pr92897.f90: New test.

-- 
Steve
Index: gcc/fortran/array.c
===================================================================
--- gcc/fortran/array.c	(revision 279239)
+++ gcc/fortran/array.c	(working copy)
@@ -859,10 +859,6 @@ gfc_set_array_spec (gfc_symbol *sym, gfc_array_spec *a
 
   if (as->corank)
     {
-      /* The "sym" has no corank (checked via gfc_add_codimension). Thus
-	 the codimension is simply added.  */
-      gcc_assert (as->rank == 0 && sym->as->corank == 0);
-
       sym->as->cotype = as->cotype;
       sym->as->corank = as->corank;
       /* Check F2018:C822.  */
Index: gcc/testsuite/gfortran.dg/pr92897.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr92897.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/pr92897.f90	(working copy)
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=single" }
+! Test contributed by Gerhard Steinmetz
+type(t) function f()                    ! { dg-error "has not been declared" }
+   dimension :: t(1,2,1,2,1,2,1,2)
+   codimension :: t[1,2,1,2,1,2,1,*]    ! { dg-error "rank \\+ corank of" }
+end
+! { dg-prune-output "which has not been defined" }

Reply via email to