https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103505

--- Comment #4 from anlauf at gcc dot gnu.org ---
(In reply to kargl from comment #2)
> diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
> index 6552eaf3b0c..1b2f5b310a7 100644
> --- a/gcc/fortran/array.c
> +++ b/gcc/fortran/array.c
> @@ -492,6 +492,9 @@ match_array_element_spec (gfc_array_spec *as)
>    if (!gfc_expr_check_typed (*upper, gfc_current_ns, false))
>      return AS_UNKNOWN;
>  
> +  if ((*upper)->expr_type != EXPR_CONSTANT)
> +    gfc_simplify_expr (*upper,0);
> +
>    if (((*upper)->expr_type == EXPR_CONSTANT
>       && (*upper)->ts.type != BT_INTEGER) ||
>        ((*upper)->expr_type == EXPR_FUNCTION

There's a second place where this needs to be inserted for the real upper bound
to fix e.g.

  integer, parameter :: z(1:(2.)) = [4, 8]

Reply via email to