diff mbox series

[fortran,committed] Fix PR 92017

Message ID 6dba264c-e865-6874-d91c-0e228834343b@tkoenig.net
State New
Headers show
Series [fortran,committed] Fix PR 92017 | expand

Commit Message

Thomas König Oct. 13, 2019, 1:47 p.m. UTC
Hello world,

I have committed the attached patch as obvious and simple after
regression-testing.

It fixes an ICE on valid for a corner case, so I don't really
feel that it needs to be backported.  If anybody disagrees,
please speak up (or do it yourself :-)

Regards

	Thomas

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.
diff mbox series

Patch

Index: expr.c
===================================================================
--- expr.c	(Revision 276937)
+++ expr.c	(Arbeitskopie)
@@ -2066,6 +2066,9 @@  simplify_parameter_variable (gfc_expr *p, int type
 
   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.  */
   if (e->expr_type != EXPR_CONSTANT && p->ref != NULL)
     e->ref = gfc_copy_ref (p->ref);