This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] More clean-up with try-finally
Dear Paul,
Paul Richard Thomas wrote:
>> I think this line can go.
>>
> I do not think that I agree.
>
> I am hard put to do it right now but I rather think that it must be
> possible to generate an integer-scalar-expression that generates a
> post block. It certainly does no harm to leave it in :-)
>
Thinking about it again, I agree: One needs to take care of se.post.
However, if one simply adds the previous line, the result for the
example below is as follows. First, one returns and then one frees the
memory:
return __result_bar;
{
void * D.1566;
D.1566 = (void *) pstr.0;
if (D.1566 != 0B)
{
__builtin_free (D.1566);
}
}
which doesn't make sense. (Ditto for the old code: The free came after
the "goto __return".) Thus, removing the line does neither harm nor
improve the situation. The real fix is to ensure that the clean up of
"se.post" comes before the "return".
Example program:
contains
function f(n)
character(len=n) :: f
end function f
subroutine bar(k,*)
return len(f(k))
end subroutine bar
end
Tobias