[Patch, fortran] PR16206 - array initializers
Paul Thomas
paulthomas2@wanadoo.fr
Sun Jun 18 06:47:00 GMT 2006
Steve,
>>There a few minor questions/details to consider see below.
>>
>>!
>>! /* Check the bounds. */
>>! if (ar->as->upper[i]
>>! && (mpz_cmp (e->value.integer,
>>! ar->as->upper[i]->value.integer) > 0
>>! || mpz_cmp (e->value.integer,
>>! ar->as->upper[i]->value.integer) > 0
>>
>>These mpz_cmp appear to be redundant.
>>
>>! || mpz_cmp (e->value.integer,
>>! ar->as->lower[i]->value.integer) < 0
>>! || mpz_cmp (e->value.integer,
>>! ar->as->lower[i]->value.integer) < 0))
>>
>>These mpz_cmp appear to be redundant.
>>
>>
Tobi pointed this out to me last night - it comes from copying the block
from find_array_section and then disengaging brain.
>>+
>>+ if ((begin && begin->expr_type != EXPR_CONSTANT)
>>+ || (finish && finish->expr_type != EXPR_CONSTANT)
>>+ || (step && step->expr_type != EXPR_CONSTANT))
>>+ return FAILURE;
>>
>>Doesn't this "return FAILURE" leak memory? Should you free at least the
>>mpz variables?
>>
>>+ {
>>+ gfc_error ("index in dimension %d is out of bounds "
>>+ "at %L", idx + 1, &ref->u.ar.c_where[idx]);
>>+ return FAILURE;
>>
>>Again, is memory leaked here?
>>
>>
>>
>>
Yes to both. I'll do the time honoured goto cleanup:
Thanks
Paul
More information about the Gcc-patches
mailing list