Commit aeb430aa by Harald Anlauf

PR fortran/93364 - ICE in gfc_set_array_spec, at fortran/array.c:879

Add missing check in gfc_set_array_spec for sum of rank and corank to not
exceed GFC_MAX_DIMENSIONS.

2020-04-20  Harald Anlauf  <anlauf@gmx.de>

	PR fortran/93364
	* array.c (gfc_set_array_spec): Check for sum of rank and corank
	not exceeding GFC_MAX_DIMENSIONS.

2020-04-20  Harald Anlauf  <anlauf@gmx.de>

	PR fortran/93364
	* gfortran.dg/pr93364.f90: New test.
parent 9b4d38df
2020-04-20 Harald Anlauf <anlauf@gmx.de>
PR fortran/93364
* array.c (gfc_set_array_spec): Check for sum of rank and corank
not exceeding GFC_MAX_DIMENSIONS.
2020-04-20 Steve Kargl <kargl@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
......
......@@ -864,6 +864,10 @@ gfc_set_array_spec (gfc_symbol *sym, gfc_array_spec *as, locus *error_loc)
return false;
}
/* Check F2018:C822. */
if (sym->as->rank + sym->as->corank > GFC_MAX_DIMENSIONS)
goto too_many;
if (as->corank)
{
sym->as->cotype = as->cotype;
......
2020-04-20 Harald Anlauf <anlauf@gmx.de>
PR fortran/93364
* gfortran.dg/pr93364.f90: New test.
2020-04-20 Steve Kargl <kargl@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
......
! { dg-do compile }
! { dg-options "-fcoarray=single" }
!
! PR fortran/93364 - check fix for ICE in gfc_set_array_spec
type(t) function f()
codimension :: t[1,2,1,2,1,2,1,*]
dimension :: t(1,2,1,2,1,2,1,2)
end
! { dg-error "has not been declared" " " { target *-*-* } 6 }
! { dg-error "is of type 't'" " " { target *-*-* } 6 }
! { dg-error "rank \\+ corank of" " " { target *-*-* } 8 }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment