This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ping: Possible patch for fortran/66107


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]