re PR fortran/91944 (ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6156)

PR fortran/91944
	* simplify.c (gfc_simplify_spread): Check gfc_init_expr_flag instead
	of gfc_current_ns->sym_root->n.sym->attr.flavor == FL_PARAMETER.

	* gfortran.dg/spread_size_limit_2.f90: New test.

From-SVN: r278762
This commit is contained in:
Jakub Jelinek 2019-11-27 11:00:50 +01:00 committed by Jakub Jelinek
parent 90ca6847bb
commit b7b848f5d7
4 changed files with 21 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2019-11-27 Jakub Jelinek <jakub@redhat.com>
PR fortran/91944
* simplify.c (gfc_simplify_spread): Check gfc_init_expr_flag instead
of gfc_current_ns->sym_root->n.sym->attr.flavor == FL_PARAMETER.
2019-11-27 Tobias Burnus <tobias@codesourcery.com>
PR middle-end/92463

View File

@ -7656,7 +7656,7 @@ gfc_simplify_spread (gfc_expr *source, gfc_expr *dim_expr, gfc_expr *ncopies_exp
nelem = mpz_get_si (size) * ncopies;
if (nelem > flag_max_array_constructor)
{
if (gfc_current_ns->sym_root->n.sym->attr.flavor == FL_PARAMETER)
if (gfc_init_expr_flag)
{
gfc_error ("The number of elements (%d) in the array constructor "
"at %L requires an increase of the allowed %d upper "

View File

@ -1,5 +1,8 @@
2019-11-27 Jakub Jelinek <jakub@redhat.com>
PR fortran/91944
* gfortran.dg/spread_size_limit_2.f90: New test.
PR c++/92524
* g++.dg/cpp0x/pr92524.C: New test.

View File

@ -0,0 +1,11 @@
! PR fortran/91944
! { dg-do compile }
! { dg-options "-fmax-array-constructor=65535" }
program pr91944
integer, parameter :: n = 10
integer, parameter :: m = 65536
integer :: i
integer :: x(n,m) = spread([(i,i=1,n)], dim=2, ncopies=m) ! { dg-error "requires an increase of the allowed 65535 upper limit" }
print *, x(n,m)
end