re PR fortran/92897 ([Coarray] ICE in gfc_set_array_spec, at fortran/array.c:864)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Wed, 11 Dec 2019 19:28:57 +0000 (19:28 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Wed, 11 Dec 2019 19:28:57 +0000 (19:28 +0000)
2019-12-11 Steven G. Kargl  <kargl@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  <kargl@gcc.gnu.org>

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

From-SVN: r279247

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

index 77675ab72b5d4f80a9793038b5f2962c24877d3e..474c0a4b676d5ebec319987b6c5c76e1b84cd8cc 100644 (file)
@@ -1,3 +1,9 @@
+2019-12-11 Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/92897
+       * array.c (gfc_set_array_spec):  Remove invalid assert() triggered
+       by invalid Fortran code.
 2019-12-10  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/91643
index 36223d2233daabc0e7b788ffa187aa91a1ca548e..1834d2f98a09be200d9dd4dfe903b9e17f00f264 100644 (file)
@@ -859,10 +859,6 @@ gfc_set_array_spec (gfc_symbol *sym, gfc_array_spec *as, locus *error_loc)
 
   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 57d2a1162c6d96e790b4627c03a55e1970f51672..120b1cdef1bffab80307dc3fa136cac573ab2159 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-11 Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/92897
+       * gfortran.dg/pr92897.f90: New test.
+
 2019-12-11  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
 
        * lib/gcc-dg.exp: Add dg-prune messages for when exception handling is
diff --git a/gcc/testsuite/gfortran.dg/pr92897.f90 b/gcc/testsuite/gfortran.dg/pr92897.f90
new file mode 100644 (file)
index 0000000..6e0f983
--- /dev/null
@@ -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" }