re PR fortran/91802 (ICE in mio_name_expr_t, at fortran/module.c:2141)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Sat, 28 Sep 2019 17:10:34 +0000 (17:10 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Sat, 28 Sep 2019 17:10:34 +0000 (17:10 +0000)
2019-09-28  Steven G. Kargl  <kargl@gcc.ngu.org>

PR fortran/91802
* decl.c (attr_decl1): Check if rank+corank > 15.

2019-09-28  Steven G. Kargl  <kargl@gcc.ngu.org>

PR fortran/91802
* gfortran.dg/pr91802.f90: New test.

From-SVN: r276254

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

index d5a17da..3d40c9a 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-28  Steven G. Kargl  <kargl@gcc.ngu.org>
+
+       PR fortran/91802
+       * decl.c (attr_decl1): Check if rank+corank > 15.
+
 2019-09-28  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/91864
index 278882d..31b2336 100644 (file)
@@ -8468,6 +8468,15 @@ attr_decl1 (void)
       goto cleanup;
     }
 
+  /* Check F2018:C822.  */
+  if (sym->attr.dimension && sym->attr.codimension
+      && sym->as && sym->as->rank + sym->as->corank > 15)
+    {
+      gfc_error ("rank + corank of %qs exceeds 15 at %C", sym->name);
+      m = MATCH_ERROR;
+      goto cleanup;
+    }
+
   if (sym->attr.cray_pointee && sym->as != NULL)
     {
       /* Fix the array spec.  */
index 8d8ba5d..5592df3 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-28  Steven G. Kargl  <kargl@gcc.ngu.org>
+
+       PR fortran/91802
+       * gfortran.dg/pr91802.f90: New test.
+
 2019-09-28  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/91864
diff --git a/gcc/testsuite/gfortran.dg/pr91802.f90 b/gcc/testsuite/gfortran.dg/pr91802.f90
new file mode 100644 (file)
index 0000000..277d61a
--- /dev/null
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=single" }
+! Code contributed by Gerhard Steinmetz
+! PR fortran/91802
+module m
+   real :: x
+   dimension ::   x(1,2,1,2,1,2,1,2)
+   codimension :: x[1,2,1,2,1,2,1,*] ! { dg-error "exceeds 15" }
+end