This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Ping: Possible patch for fortran/66107
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: Louis Krupp <louis dot krupp at zoho dot com>
- Cc: fortran <fortran at gcc dot gnu dot org>
- Date: Wed, 21 Sep 2016 15:26:31 -0700
- Subject: Re: Ping: Possible patch for fortran/66107
- Authentication-results: sourceware.org; auth=none
- References: <1574ebbd2aa.fd852aa22684.7867990997601359492@zoho.com>
- Reply-to: kargl at uw dot edu
On Wed, Sep 21, 2016 at 02:51:54PM -0700, Louis Krupp wrote:
>
> PR fortran/77391
> Index: gcc/fortran/decl.c
> ===================================================================
> --- gcc/fortran/decl.c (revision 240025)
> +++ gcc/fortran/decl.c (working copy)
> @@ -1671,7 +1671,19 @@ add_init_expr_to_sym (const char *name, gfc_expr *
> else if (init->expr_type == EXPR_ARRAY)
> {
> if (init->ts.u.cl)
> - clen = mpz_get_si (init->ts.u.cl->length->value.integer);
> + {
> + const gfc_expr *length = init->ts.u.cl->length;
> + if (length->expr_type != EXPR_CONSTANT)
> + {
> + gfc_error ("Can't initialize parameter array "
> + "at %L "
> + "with variable length elements",
> + &sym->declared_at);
> + return false;
Looks okay to me, although I would avoid the contraction
in the error message. Use "Cannot" or "Invalid initialization
of ..."
--
Steve