[patch, fortran] PR32432 SEGV/endless loop after: "ERROR: ... already is initialized"
Janne Blomqvist
blomqvist.janne@gmail.com
Tue Jul 3 07:18:00 GMT 2007
:REVIEWMAIL:
On 7/3/07, Jerry DeLisle <jvdelisle@verizon.net> wrote:
> OK for trunk?
Yes. A few minor issues below though.
*************** gfc_assign_data_value (gfc_expr *lvalue,
*** 293,300 ****
gfc_error ("'%s' at %L already is initialized at %L",
lvalue->symtree->n.sym->name, &lvalue->where,
&init->where);
! gfc_free_expr (init);
! init = NULL;
}
if (init == NULL)
--- 295,301 ----
gfc_error ("'%s' at %L already is initialized at %L",
lvalue->symtree->n.sym->name, &lvalue->where,
&init->where);
! return FAILURE;
}
Won't this create a memory leak as you are no longer freeing init?
*************** gfc_assign_data_value (gfc_expr *lvalue,
*** 423,428 ****
--- 424,431 ----
symbol->value = expr;
else
last_con->expr = expr;
+
+ return t;
}
Why not get rid of the t variable and just "return SUCCESS;", since
you never actually use the t variable for anything beyond initially
setting it to SUCCESS?
Similarly in resolve.c,
! t = gfc_assign_data_value (var->expr, values.vnode->expr, offset);
! if (t == FAILURE)
! break;
Why not just
if (gfc_assign_data_value (...) == FAILURE)
break;
Finally, please use unified diffs in the future; I suspect I'm not the
only one who has difficulties following context diffs.
Thanks for the patch.
--
Janne Blomqvist
More information about the Fortran
mailing list