re PR fortran/44742 (ICE in gfc_conv_array_initializer)
2010-07-06 Tobias Burnus <burnus@net-b.de> PR fortran/44742 * array.c (gfc_expand_constructor): Add optional diagnostic. * gfortran.h (gfc_expand_constructor): Update prototype. * expr.c (gfc_simplify_expr, check_init_expr, gfc_reduce_init_expr): Update gfc_expand_constructor call. * resolve.c (gfc_resolve_expr): Ditto. 2010-07-06 Tobias Burnus <burnus@net-b.de> PR fortran/44742 * gfortran.dg/parameter_array_init_6.f90: New. * gfortran.dg/initialization_20.f90: Update dg-error. * gfortran.dg/initialization_24.f90: Ditto. From-SVN: r161888
This commit is contained in:
parent
c829d0163d
commit
928f049082
9 changed files with 52 additions and 9 deletions
|
@ -1,3 +1,12 @@
|
|||
2010-07-06 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
PR fortran/44742
|
||||
* array.c (gfc_expand_constructor): Add optional diagnostic.
|
||||
* gfortran.h (gfc_expand_constructor): Update prototype.
|
||||
* expr.c (gfc_simplify_expr, check_init_expr,
|
||||
gfc_reduce_init_expr): Update gfc_expand_constructor call.
|
||||
* resolve.c (gfc_resolve_expr): Ditto.
|
||||
|
||||
2010-07-06 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
* trans-decl.c: Include diagnostic-core.h besides toplev.h.
|
||||
|
|
|
@ -1545,7 +1545,7 @@ gfc_get_array_element (gfc_expr *array, int element)
|
|||
constructor if they are small enough. */
|
||||
|
||||
gfc_try
|
||||
gfc_expand_constructor (gfc_expr *e)
|
||||
gfc_expand_constructor (gfc_expr *e, bool fatal)
|
||||
{
|
||||
expand_info expand_save;
|
||||
gfc_expr *f;
|
||||
|
@ -1557,6 +1557,15 @@ gfc_expand_constructor (gfc_expr *e)
|
|||
if (f != NULL)
|
||||
{
|
||||
gfc_free_expr (f);
|
||||
if (fatal)
|
||||
{
|
||||
gfc_error ("The number of elements in the array constructor "
|
||||
"at %L requires an increase of the allowed %d "
|
||||
"upper limit. See -fmax-array-constructor "
|
||||
"option", &e->where,
|
||||
gfc_option.flag_max_array_constructor);
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -1894,7 +1894,7 @@ gfc_simplify_expr (gfc_expr *p, int type)
|
|||
|
||||
if (p->expr_type == EXPR_ARRAY && p->ref && p->ref->type == REF_ARRAY
|
||||
&& p->ref->u.ar.type == AR_FULL)
|
||||
gfc_expand_constructor (p);
|
||||
gfc_expand_constructor (p, false);
|
||||
|
||||
if (simplify_const_ref (p) == FAILURE)
|
||||
return FAILURE;
|
||||
|
@ -2573,7 +2573,7 @@ check_init_expr (gfc_expr *e)
|
|||
if (t == FAILURE)
|
||||
break;
|
||||
|
||||
t = gfc_expand_constructor (e);
|
||||
t = gfc_expand_constructor (e, true);
|
||||
if (t == FAILURE)
|
||||
break;
|
||||
|
||||
|
@ -2609,7 +2609,7 @@ gfc_reduce_init_expr (gfc_expr *expr)
|
|||
{
|
||||
if (gfc_check_constructor_type (expr) == FAILURE)
|
||||
return FAILURE;
|
||||
if (gfc_expand_constructor (expr) == FAILURE)
|
||||
if (gfc_expand_constructor (expr, true) == FAILURE)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -2715,7 +2715,7 @@ gfc_try gfc_resolve_array_spec (gfc_array_spec *, int);
|
|||
int gfc_compare_array_spec (gfc_array_spec *, gfc_array_spec *);
|
||||
|
||||
void gfc_simplify_iterator_var (gfc_expr *);
|
||||
gfc_try gfc_expand_constructor (gfc_expr *);
|
||||
gfc_try gfc_expand_constructor (gfc_expr *, bool);
|
||||
int gfc_constant_ac (gfc_expr *);
|
||||
int gfc_expanded_ac (gfc_expr *);
|
||||
gfc_try gfc_resolve_character_array_constructor (gfc_expr *);
|
||||
|
|
|
@ -5776,7 +5776,7 @@ gfc_resolve_expr (gfc_expr *e)
|
|||
{
|
||||
expression_rank (e);
|
||||
if (gfc_is_constant_expr (e) || gfc_is_expandable_expr (e))
|
||||
gfc_expand_constructor (e);
|
||||
gfc_expand_constructor (e, false);
|
||||
}
|
||||
|
||||
/* This provides the opportunity for the length of constructors with
|
||||
|
@ -5786,7 +5786,7 @@ gfc_resolve_expr (gfc_expr *e)
|
|||
{
|
||||
/* For efficiency, we call gfc_expand_constructor for BT_CHARACTER
|
||||
here rather then add a duplicate test for it above. */
|
||||
gfc_expand_constructor (e);
|
||||
gfc_expand_constructor (e, false);
|
||||
t = gfc_resolve_character_array_constructor (e);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2010-07-06 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
PR fortran/44742
|
||||
* gfortran.dg/parameter_array_init_6.f90: New.
|
||||
* gfortran.dg/initialization_20.f90: Update dg-error.
|
||||
* gfortran.dg/initialization_24.f90: Ditto.
|
||||
|
||||
2010-07-06 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||
PR fortran/PR44693
|
||||
* gfortran.dg/dim_range_1.f90: New test.
|
||||
|
|
|
@ -6,5 +6,5 @@ program pr19925
|
|||
integer j
|
||||
integer, parameter :: n = 100000
|
||||
integer, parameter :: i(n)=(/(j,j=1,n)/) ! { dg-error "number of elements" }
|
||||
print *, i(5)
|
||||
print *, i(5) ! { dg-error "has no IMPLICIT type" }
|
||||
end program pr19925
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
! Test case by Dominique d'Humieres
|
||||
INTEGER, PARAMETER ::N=65536
|
||||
INTEGER, PARAMETER ::I(N)=(/(MOD(K,2),K=1,N)/)!{ dg-error "number of elements" }
|
||||
INTEGER, PARAMETER ::M(N)=I(N:1:-1)
|
||||
INTEGER, PARAMETER ::M(N)=I(N:1:-1) ! { dg-error "Syntax error in argument" }
|
||||
print *, I(1), M(1), I(N), M(N)
|
||||
END
|
||||
|
||||
|
|
18
gcc/testsuite/gfortran.dg/parameter_array_init_6.f90
Normal file
18
gcc/testsuite/gfortran.dg/parameter_array_init_6.f90
Normal file
|
@ -0,0 +1,18 @@
|
|||
! { dg-do compile }
|
||||
!
|
||||
! PR fortran/44742
|
||||
!
|
||||
! Test case based on Juergen Reuter's and reduced by
|
||||
! Janus Weil.
|
||||
!
|
||||
! The program creates a large array constructor, which
|
||||
! exceeds -fmax-array-constructor - and caused an ICE.
|
||||
!
|
||||
|
||||
module proc8
|
||||
implicit none
|
||||
integer, parameter :: N = 256
|
||||
logical, dimension(N**2), parameter :: A = .false.
|
||||
logical, dimension(N,N), parameter :: B &
|
||||
= reshape ( (/ A /), (/ N, N /) ) ! { dg-error "array constructor at .1. requires an increase" }
|
||||
end module
|
Loading…
Add table
Reference in a new issue