re PR fortran/42309 (Problem with a pointer array passed to a subroutine)

PR fortran/42309
	* trans-expr.c (gfc_conv_subref_array_arg): Avoid accessing
	info->dimen after info has been freed.

From-SVN: r156660
This commit is contained in:
Jakub Jelinek 2010-02-10 16:11:30 +01:00 committed by Jakub Jelinek
parent cdaa27b170
commit 8ce8557350
2 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2010-02-10 Jakub Jelinek <jakub@redhat.com>
PR fortran/42309
* trans-expr.c (gfc_conv_subref_array_arg): Avoid accessing
info->dimen after info has been freed.
2010-02-06 Paul Thomas <pault@gcc.gnu.org>
PR fortran/42309

View File

@ -2135,6 +2135,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, int g77,
tree size;
stmtblock_t body;
int n;
int dimen;
gcc_assert (expr->expr_type == EXPR_VARIABLE);
@ -2263,9 +2264,10 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, int g77,
outside the innermost loop, so the overall transfer could be
optimized further. */
info = &rse.ss->data.info;
dimen = info->dimen;
tmp_index = gfc_index_zero_node;
for (n = info->dimen - 1; n > 0; n--)
for (n = dimen - 1; n > 0; n--)
{
tree tmp_str;
tmp = rse.loop->loopvar[n];
@ -2325,13 +2327,13 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, int g77,
if (expr->ts.type == BT_CHARACTER)
parmse->string_length = expr->ts.cl->backend_decl;
/* Determine the offset for pointer formal arguments ans set the
/* Determine the offset for pointer formal arguments and set the
lbounds to one. */
if (formal_ptr)
{
size = gfc_index_one_node;
offset = gfc_index_zero_node;
for (n = 0; n < info->dimen; n++)
for (n = 0; n < dimen; n++)
{
tmp = gfc_conv_descriptor_ubound (parmse->expr,
gfc_rank_cst[n]);