[PATCH,fortran] Fix PR 31244

FX Coudert fxcoudert@gmail.com
Fri Oct 5 22:51:00 GMT 2007


I was clearing my mail backlog, and apparently this patch wasn't  
reviewed, sorry Steve!

> I had an alternative patch that put a sane limit on
> the repeat count and documented this limit in manual.
> Personally, I preferred this patch.

Sanity check: you prefer the patch you submitted to the patch adding  
a limit, did I get it right?

> 2007-09-24  Steven G. Kargl  <kargl@gcc.gnu.org>
>
> 	PR fortran/31244
> 	* decl.c (free_value): Clear mpz value.
> 	(top_val_list): Convert variable from unsigned int to mpz_t.
> 	* gfortran.h (gfc_data_value): Ditto.
> 	* resolve.c (struct values): Ditto
> 	(next_data_value): Use mpz_t variable.
> 	(check_data_variable): Ditto.
> 	(resolve_data): Ditto.

OK, with the following modification:

> -	  signed int tmp;
> -	  msg = gfc_extract_int (expr, &tmp);
> +	  if (expr->ts.type == BT_INTEGER)
> +	    mpz_set (tail->repeat, expr->value.integer);
>  	  gfc_free_expr (expr);

I think, to be consistent with what gfc_extract_int() did, we should  
add a check that the expression is an EXPR_CONSTANT of type  
BT_INTEGER, and otherwise call gfc_error(). Maybe this is already  
checked somewhere, in which case I've missed it.

Also, a formatting question. In the following, is the blank line  
consistent with GCC coding style? (I don't think so, and never put one.)

>  static void
> -resolve_data (gfc_data * d)
> +resolve_data (gfc_data *d)
>  {
> +
>    if (resolve_data_variables (d->var) == FAILURE)
>      return;

Thanks,
FX



More information about the Fortran mailing list