+2020-04-01 Mark Eggleston <mark.eggleston@codethink.com>
+
+ PR fortran/94386
+ expr.c (simplify_parameter_variable): Restore code deleted
+ in PR94246.
+
2020-03-28 Paul Thomas <pault@gcc.gnu.org>
PR fortran/94246
}
gfc_expression_rank (p);
+ /* Is this an inquiry? */
+ bool inquiry = false;
+ gfc_ref* ref = p->ref;
+ while (ref)
+ {
+ if (ref->type == REF_INQUIRY)
+ break;
+ ref = ref->next;
+ }
+ if (ref && ref->type == REF_INQUIRY)
+ inquiry = ref->u.i == INQUIRY_LEN || ref->u.i == INQUIRY_KIND;
+
if (gfc_is_size_zero_array (p))
{
if (p->expr_type == EXPR_ARRAY)
e->value.constructor = NULL;
e->shape = gfc_copy_shape (p->shape, p->rank);
e->where = p->where;
- gfc_replace_expr (p, e);
- return true;
+ /* If %kind and %len are not used then we're done, otherwise
+ drop through for simplification. */
+ if (!inquiry)
+ {
+ gfc_replace_expr (p, e);
+ return true;
+ }
}
+ else
+ {
+ e = gfc_copy_expr (p->symtree->n.sym->value);
+ if (e == NULL)
+ return false;
- e = gfc_copy_expr (p->symtree->n.sym->value);
- if (e == NULL)
- return false;
-
- 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);