Dear Tobias, OK for trunk. As you say, the testcase does no harm and so should be retained.
Thanks for the patch. Cheers Paul On 21 May 2012 19:51, Tobias Burnus <bur...@net-b.de> wrote: > First: I have another rather simple patch, which still needs to be reviewed: > http://gcc.gnu.org/ml/fortran/2012-05/msg00086.html > > * * * > > When a realloc on assignment is done, gfortran first obtains the descriptor > by calling realloc_lhs_loop_for_fcn_call and then does the actual function > call using gfc_conv_function_expr. > > However, realloc_lhs_loop_for_fcn_call already causes that the RHS is > evaluated (via gfc_add_loop_ss_code). The double evaluation of an inner > function call, causes memory leaks - and double evaluation > (correctness/performance issue). > > The following code solves the issue. I am not 100% sure that it correctly > does so, but it solved the problem and the testsuite passed. (It might > obsolete the check in "se->direct_byref" of gfc_conv_procedure_call.) > > > The test case is a bit pointless as it will only fail if one uses valgrind > on it; thus, one could consider committing the patch even without. However, > it might not harm to have it in the test suite. > > > Build and regtested on x86-64-linux. > OK for the trunk and 4.6/4.7? > > Tobias -- The knack of flying is learning how to throw yourself at the ground and miss. --Hitchhikers Guide to the Galaxy