re PR fortran/87993 (ICE in gfc_constructor_first, at fortran/constructor.c:234)

2019-08-13  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/87993
	* expr.c (gfc_simplify_expr): Simplifcation of an array with a kind
	type inquiry suffix yields a constant expression.

2019-08-13  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/87993
	* gfortran.dg/pr87993.f90: New test.

From-SVN: r274388
This commit is contained in:
Steven G. Kargl 2019-08-13 18:06:08 +00:00
parent c53bb876f4
commit 48668ee0d2
4 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2019-08-13 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/87993
* expr.c (gfc_simplify_expr): Simplifcation of an array with a kind
type inquiry suffix yields a constant expression.
2019-08-13 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/91414

View File

@ -2227,6 +2227,11 @@ gfc_simplify_expr (gfc_expr *p, int type)
if (!simplify_ref_chain (p->ref, type, &p))
return false;
/* If the following conditions hold, we found something like kind type
inquiry of the form a(2)%kind while simplify the ref chain. */
if (p->expr_type == EXPR_CONSTANT && !p->ref && !p->rank && !p->shape)
return true;
if (!simplify_constructor (p->value.constructor, type))
return false;

View File

@ -1,3 +1,8 @@
2019-08-13 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/87993
* gfortran.dg/pr87993.f90: New test.
2019-08-13 Martin Sebor <msebor@redhat.com>
PR c/80619

View File

@ -0,0 +1,8 @@
! { dg-do run }
! Code contributed by Gerhard Steinmetz <gscfq at t-online dot de>
program p
integer, parameter :: a(2) = 1
integer, parameter :: b = a%kind
if (any(a /= 1)) stop 1
if (b /= kind(a)) stop 2
end