[PATCH] PR fortran/91802 -- rank+corank must be less than 16

Steve Kargl sgk@troutmask.apl.washington.edu
Sat Sep 28 17:11:00 GMT 2019


Committed as r276254.

-- 
steve

On Tue, Sep 24, 2019 at 03:49:06PM -0700, Steve Kargl wrote:
> The attached patch has been tested on x86_64-*-freebsd.  OK to commit?
> 
> 2019-09-24  Steven G. Kargl  <kargl@gcc.ngu.org>
> 
> 	PR fortran/91802
> 	* decl.c (attr_decl1): Check if rank+corank > 15.
> 
> 2019-09-24  Steven G. Kargl  <kargl@gcc.ngu.org>
> 
> 	PR fortran/91802
> 	* gfortran.dg/pr91802.f90: New test.
> -- 
> Steve

> Index: gcc/fortran/decl.c
> ===================================================================
> --- gcc/fortran/decl.c	(revision 275969)
> +++ gcc/fortran/decl.c	(working copy)
> @@ -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: gcc/testsuite/gfortran.dg/pr91802.f90
> ===================================================================
> --- gcc/testsuite/gfortran.dg/pr91802.f90	(nonexistent)
> +++ gcc/testsuite/gfortran.dg/pr91802.f90	(working copy)
> @@ -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


-- 
Steve
20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4
20161221 https://www.youtube.com/watch?v=IbCHE-hONow



More information about the Gcc-patches mailing list