------- Comment #5 from pault at gcc dot gnu dot org 2006-10-25 07:18 ------- This fixes it but has not been regtested. I was hoping to have found a slightly cleaner way to fix this but did not alight on anything that would not be a big performance. It's OK for rank 1 arrays but for rank 2 or higher, carries baggage in the form of various other declarations from the loopinfo that was never used.
Index: gcc/fortran/trans-expr.c =================================================================== *** gcc/fortran/trans-expr.c (revision 117860) --- gcc/fortran/trans-expr.c (working copy) *************** gfc_conv_aliased_arg (gfc_se * parmse, g *** 1708,1716 **** } else { ! /* Make sure that the temporary declaration survives. */ ! tmp = gfc_finish_block (&body); ! gfc_add_expr_to_block (&loop.pre, tmp); } /* Add the post block after the second loop, so that any --- 1708,1721 ---- } else { ! /* Make sure that the temporary declaration survives by merging ! all the loop declarations into the current context. */ ! for (n = 0; n < loop.dimen; n++) ! { ! gfc_merge_block_scope (&body); ! body = loop.code[loop.order[n]]; ! } ! gfc_merge_block_scope (&body); } /* Add the post block after the second loop, so that any Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29565