diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a2a3c8b8df6..0e562a8f278 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2010-02-10 Jakub Jelinek + + PR fortran/42309 + * trans-expr.c (gfc_conv_subref_array_arg): Avoid accessing + info->dimen after info has been freed. + 2010-02-09 Jerry DeLisle PR fortran/42999 diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 4a70e739e4a..5c3aa850d3d 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -2311,6 +2311,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); @@ -2439,9 +2440,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]; @@ -2508,7 +2510,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, int g77, { 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_get (parmse->expr, gfc_rank_cst[n]);