From: Steven G. Kargl Date: Tue, 1 Oct 2019 18:58:01 +0000 (+0000) Subject: backport: re PR fortran/91802 (ICE in mio_name_expr_t, at fortran/module.c:2141) X-Git-Tag: releases/gcc-9.3.0~584 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d280a1cfd06547ae057f277a40f532074bc4f9f;p=thirdparty%2Fgcc.git backport: re PR fortran/91802 (ICE in mio_name_expr_t, at fortran/module.c:2141) 2019-10-01 Steven G. Kargl Backport of r276254+276265 PR fortran/91802 * decl.c (attr_decl1): Check if rank+corank > 15. 2019-10-01 Steven G. Kargl PR fortran/91802 * gfortran.dg/pr91802.f90: New test. From-SVN: r276423 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 6d550ef9a362..691bca48e151 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-10-01 Steven G. Kargl + + Backport of r276254+276265 + PR fortran/91802 + * decl.c (attr_decl1): Check if rank+corank > 15. + 2019-10-01 Steven G. Kargl PR fortran/91714 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 30470911eeda..b497b760bbad 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -8444,6 +8444,14 @@ 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); + return MATCH_ERROR; + } + if (sym->attr.cray_pointee && sym->as != NULL) { /* Fix the array spec. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 106dbb078f83..949fa2f10c53 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-10-01 Steven G. Kargl + + PR fortran/91802 + * gfortran.dg/pr91802.f90: New test. + 2019-10-01 Steven G. Kargl PR fortran/91714 diff --git a/gcc/testsuite/gfortran.dg/pr91802.f90 b/gcc/testsuite/gfortran.dg/pr91802.f90 new file mode 100644 index 000000000000..277d61aae82c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr91802.f90 @@ -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