Another case of a spurious pack (which really affects performance
unfortunately).
> cat test.f90
MODULE M1
CONTAINS
SUBROUTINE S1(data)
REAL, DIMENSION(*) :: data
END SUBROUTINE S1
END MODULE
SUBROUTINE S2
REAL :: data(10,10)
DO i=1,10
CALL S1(data(:,i))
ENDDO
DO i=1,10
CALL S1(data(1,i))
ENDDO
END SUBROUTINE S2
> cat test.f90.003t.original
s1 (real(kind=4)[0:] * data)
{
(void) 0;
}
s2 ()
{
real(kind=4) data[100];
integer(kind=4) i;
i = 1;
if (i <= 10)
{
while (1)
{
{
logical(kind=4) D.1557;
{
void * D.1554;
struct array1_real(kind=4) parm.0;
integer(kind=8) D.1543;
D.1543 = (integer(kind=8)) i;
parm.0.dtype = 281;
parm.0.dim[0].lbound = 1;
parm.0.dim[0].ubound = 10;
parm.0.dim[0].stride = 1;
parm.0.data = (void *) &data[(D.1543 + -1) * 10];
parm.0.offset = -11;
D.1554 = _gfortran_internal_pack (&parm.0);
s1 (D.1554);
if ((real(kind=4)[0:] *) parm.0.data != (real(kind=4)[0:] *)
D.1554)
{
_gfortran_internal_unpack (&parm.0, D.1554);
{
void * D.1555;
D.1555 = D.1554;
if (D.1555 != 0B)
{
__builtin_free (D.1555);
}
}
}
}
L.1:;
D.1557 = i == 10;
i = i + 1;
if (D.1557) goto L.2;
}
}
}
L.2:;
i = 1;
if (i <= 10)
{
while (1)
{
{
logical(kind=4) D.1560;
s1 (&data[((integer(kind=8)) i + -1) * 10]);
L.3:;
D.1560 = i == 10;
i = i + 1;
if (D.1560) goto L.4;
}
}
}
L.4:;
}
--
Summary: spurious _gfortran_internal_pack (II)
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: jv244 at cam dot ac dot uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41117