[Bug fortran/61831] [4.9/ 5 Regression] runtime error: pointer being freed was not allocated
mikael at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Feb 22 20:37:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61831
--- Comment #39 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #38)
> By the way, I'm not sure that it's at all correct to avoid deep copies.
This seems to be safe:
as long as the procedure is pure, there is no way it can modify its input data.
> It's an artefact of temporary management which on one hand avoids deep
> copies, but on the other hand frees allocated components as for a regular
> object, as if a deep copy had happened before.
So, the problem is limited to derived types, which basically come from
expressions
of type EXPR_FUNCTION (or its variants EXPR_PPC, EXPR_COMPCALL), EXPR_ARRAY,
and EXPR_STRUCTURE.
A function will do a deep copy, so I think the only problematic cases are
EXPR_ARRAY, and maybe EXPR_STRUCTURE.
More information about the Gcc-bugs
mailing list