Currently, even for a INTENT(IN) variable _gfortran_internal_unpack is called.

    D.1036 = _gfortran_internal_pack (&parm.1);
    foo (D.1036);
    if ((integer(kind=4)[0:] *) parm.1.data != (integer(kind=4)[0:] *) D.1036)
      {
        _gfortran_internal_unpack (&parm.1, D.1036);
        if (D.1036 != 0B)
              __builtin_free (D.1037);
      }

For INTENT(IN) the  _gfortran_internal_unpack  call can be eliminated for good.
I think the rest can stay and also for INTENT(OUT) the status quo is OK.


Test case:

program test
  implicit none
  integer :: a(3,3)
  call foo(a(1,:))
contains
  subroutine foo(x)
    integer,intent(in) :: x(3)
  end subroutine foo
end program test


-- 
           Summary: INTENT(IN) formal -> No need to call
                    _gfortran_internal_unpack
           Product: gcc
           Version: 4.4.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=36909

Reply via email to