Commit 19400cb9 by Thomas Koenig

re PR fortran/92017 (ICE in gfc_expr_attr, at fortran/primary.c:2674)

2019-10-13  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/92017
	* expr.c (simplify_parameter_variable): Set the character length
	of the result expression from the original expression if
	necessary.

2019-10-13  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/92017
	* gfortran.dg/minmaxloc_14.f90: New test.

From-SVN: r276938
parent 855c21cb
2019-10-13 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/92017
* expr.c (simplify_parameter_variable): Set the character length
of the result expression from the original expression if
necessary.
2019-10-11 Steven G. Kargl <kargl@gcc.gnu.org> 2019-10-11 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91649 PR fortran/91649
......
...@@ -2066,6 +2066,9 @@ simplify_parameter_variable (gfc_expr *p, int type) ...@@ -2066,6 +2066,9 @@ simplify_parameter_variable (gfc_expr *p, int type)
e->rank = p->rank; e->rank = p->rank;
if (e->ts.type == BT_CHARACTER && e->ts.u.cl == NULL)
e->ts.u.cl = gfc_new_charlen (gfc_current_ns, p->ts.u.cl);
/* Do not copy subobject refs for constant. */ /* Do not copy subobject refs for constant. */
if (e->expr_type != EXPR_CONSTANT && p->ref != NULL) if (e->expr_type != EXPR_CONSTANT && p->ref != NULL)
e->ref = gfc_copy_ref (p->ref); e->ref = gfc_copy_ref (p->ref);
......
2019-10-13 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/92017
* gfortran.dg/minmaxloc_14.f90: New test.
2019-10-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2019-10-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* lib/target-supports.exp (add_options_for_c99_runtime): Remove. * lib/target-supports.exp (add_options_for_c99_runtime): Remove.
......
! { dg-do compile }
! PR 92017 - this used to cause an ICE due do a missing charlen.
! Original test case by Gerhard Steinmetz.
program p
character(3), parameter :: a(4) = 'abc'
integer, parameter :: b(1) = minloc(a)
integer, parameter :: c = minloc(a, dim=1)
integer, parameter :: bb(1) = maxloc(a)
integer, parameter :: c2 = maxloc(a,dim=1)
end program p
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