[PATCH,fortran] Fix PR 31244

Steve Kargl sgk@troutmask.apl.washington.edu
Mon Oct 22 22:14:00 GMT 2007


On Fri, Oct 05, 2007 at 04:41:07PM -0700, Steve Kargl wrote:
> On Fri, Oct 05, 2007 at 11:51:06PM +0100, FX Coudert wrote:
> > >-	  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.
> 
> I'll check the code, again.  If EXPR_CONSTANT isn't checked currently,
> I'll add a some code.
> 

I checked and a check against EXPR_CONSTANT is unneeded.  Lines 397 and
following are

      m = match_data_constant (&expr);
      if (m == MATCH_NO)
	goto syntax;
      if (m == MATCH_ERROR)
	return MATCH_ERROR;

The checking for EXPR_CONSTANT is done here.

The patch that I committed is attached.


2007-10-22  Steven G. Kargl  <kargl@gcc.gnu.org>

	* gfortran.h (gfc_data_value): Change repeat from unsigned int
	to mpz_t.
	* decl.c(top_val_list): Remove msg variable.  Use mpz_t for
	repeat count.
	* resolve.c (values):  Change left from unsigned int to mpz_t.
	(next_data_value): Change for mpz_t.
	(check_data_variable): Change ??? to FIXME in a comment.  Use
	"mpz_t left".
	(resolve_data ): Use "mpz_t left".

-- 
Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr31244.diff
Type: text/x-diff
Size: 4021 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20071022/f1aa3296/attachment.bin>


More information about the Fortran mailing list