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

             Bug #: 52243
           Summary: Avoid reallocation for:  array1 = array1 / scalar  for
                    performance
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org
                CC: pa...@gcc.gnu.org


Some testing with -Wrealloc-lhs (PR 52196) showed that it is rather common to
encounter the following code.

gfortran inserts a reallocation check - but as the same array is on the LHS and
on the RHS, the LHS must be allocated with the correct shape is the same.
Hence, no reallocation check should be inserted (missed optimization):

        nablamat=nablamat*hescale
         kpoints=kpoints/scale                                
      hreal=hreal/cmplx(real(nkpts),0.0)

    y2 = y2 + y

      ylm = conjg( ylm )
      phasusbmat=conjg(phasusbmat)

      cc = det * transpose(cc)

Reply via email to