http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51306
Bug #: 51306
Summary: MOVE_ALLOC: Make more middle end friendlier
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
Currently, for MOVE_ALLOC, _gfortran_move_alloc(from, to) is called, which
frees to->data, copies manually all data from "from" to "to" and then sets
to->data = NULL.
I think it should be possible to replace the call by a much more middle-end
friendly:
free (to->data); // seemingly already exists in the caller
*to = *from
from = NULL;
I do not see anything which speaks against it as every field of the array
descriptor seems to be copied. (If this is not possible, one should move all
nonarray descriptor stuff, especially the "from = NULL" to the front end and
use a "fn spec".)