===================================================================
@@ -2225,6 +2225,9 @@ found:
return MATCH_NO;
}
+ if (e->expr_type != EXPR_CONSTANT)
+ goto ohno;
+
gfc_next_char (); /* Burn the ')'. */
ts->kind = (int) mpz_get_si (e->value.integer);
if (gfc_validate_kind (ts->type, ts->kind , true) == -1)
@@ -2238,6 +2241,8 @@ found:
return MATCH_YES;
}
}
+
+ohno:
/* If a type is not matched, simply return MATCH_NO. */
gfc_current_locus = old_locus;
===================================================================
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/88206
+program p
+ integer, parameter :: z(4) = [1,2,3,4]
+ integer :: k = 2
+ print *, [real(z(k))]
+end
+