http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42112
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu.org --- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-11-25 08:17:26 UTC --- (In reply to comment #5) > at the core of the original problem: > > At trans-array.c:6958 > ie. deallocation is not done on procedure entry for results. I believe that > this is incorrect for gfortran's pass by reference handling of function > results. Actually one needs to be careful: For a = f() which is transferred as f(&a) the "a" may not be deallocated as otherwise pointers to "a" may break. One probably needs: a) If "a" is no TARGET: deallocate (a) f(&a) b) If "a" is a TARGET f(tmp) memcpy(a,tmp)