>From a c.l.f post by "prcirrus".
i...@linux-fd1f:~/Krempel/Pack> cat haha.f90
module te
type av
real a1, a2
end type av
end module te
PROGRAM test2
use te
parameter (mxrec=10000)
type(av) dat(mxrec)
logical mask(mxrec)
nrec=6000
mask(1:nrec) = .false.
dat(1:nrec) = pack(dat(1:nrec),mask(1:nrec))
END program test2
i...@linux-fd1f:~/Krempel/Pack> gfortran -Warray-temporaries -fbounds-check
haha.f90
haha.f90:15.18:
dat(1:nrec) = pack(dat(1:nrec),mask(1:nrec))
1
Warnung: Creating array temporary at (1)
i...@linux-fd1f:~/Krempel/Pack> ./a.out
i...@linux-fd1f:~/Krempel/Pack>
We create a temporary, which is filled by the pack intrinsic (so no
bounds checking is done), and then later copied. On the copy, we
miss the bounds violation.
--
Summary: Unneded temporary / missed bounds violation for PACK
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: missed-optimization, diagnostic
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tkoenig at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45057