[Bug fortran/41911] New: Unnecessary copying of array descriptors

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Nov 2 18:49:00 GMT 2009


Follow up to PR 41907.

----------------
module m
contains
  subroutine one(a)
    real, dimension(:,:), intent(inout) :: a
    call two(a)
  end subroutine one
  subroutine two(a)
    real, dimension(:,:), intent(inout) :: a
  end subroutine two
end module
----------------

As both "one" and "two" have a assumed-shape argument (deferred shape would be
the same), there is absolutely no reason to copy the array descriptor. But
gfortran does so:

  a.0 = (real(kind=4)[0:D.1405] * restrict) a->data;
  parm.6.data = (void *) &(*a.0)[0];
  two (&parm.6);

For assume-size/explicit-size arrays, gfortran does do it correctly. Also for
deferred-size arrays. It also works with allocatable components, e.g
  call two(t%a)
where "a" is "allocatable, dimension(:)".


-- 
           Summary: Unnecessary copying of array descriptors
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          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=41911



More information about the Gcc-bugs mailing list