Maybe this could be handled by the Middle End, once the array operations in the
ME are implemented. This would save us from checking the alias information in
the FE.

Regarding the "Middle-End Array Expressions", see:
http://www.gccsummit.org/2008/gcc-2008-proceedings.pdf, pp. 33-42.

 * * *

From: http://gcc.gnu.org/ml/fortran/2008-07/msg00166.html

PS The example from Daniel,

SUBROUTINE sub(I)
 REAL, PARAMETER :: PI = 3.1415
 REAL, DIMENSION(:), POINTER   :: I
 I = 2.0 * PI**2 * I
END SUBROUTINE

produces a temporary because the scalarizer makes no attempt to
resolve pointers, for obvious reasons.  We could add a check that the
only pointer on the rhs is the same as that on the lhs, with no
dependencies, and that there are no targets in the rhs expression.


-- 
           Summary: Unneccessary array temporary for  same_array = scalar *
                    same_array
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36915

Reply via email to