public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/29952]  New: Flag to give runtime information " array temporary was created for argument"
@ 2006-11-23  9:49 burnus at gcc dot gnu dot org
  2006-11-23 18:31 ` [Bug fortran/29952] " pault at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-11-23  9:49 UTC (permalink / raw)
  To: gcc-bugs

Intel has a nice feature to find bad array definitions.
Somehow thinking of C I wrote:
  real :: coord(N,3)
rather than coord(3,N). Using "ifort -check arg_temp_created" this gave then
such information at run time (in my example below 20 times):

"forrtl: warning (402): fort: (1): In call to DISTANCE, an array temporary was
created for argument #1"

While one can sometimes not prevent the need for a array temporary, one often
can and should do so to speed up the program.

Example program:
---------------------------------
program tmp
  implicit none
  integer, parameter :: N = 20
  real               :: coord(N,3) ! better: (3,N)
  integer            :: i
  real               :: d
  coord = 0.0
  do i=1,N
    d = distance(coord(i,:))
  end do
contains
  function distance(a)
    real :: a(3)
    real :: distance
    distance = sqrt(a(1)**2 + a(2)**2 + a(3)**2)
  end function distance
end program tmp


-- 
           Summary: Flag to give runtime information " array temporary was
                    created for argument"
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          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=29952


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-07-27 10:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-23  9:49 [Bug fortran/29952] New: Flag to give runtime information " array temporary was created for argument" burnus at gcc dot gnu dot org
2006-11-23 18:31 ` [Bug fortran/29952] " pault at gcc dot gnu dot org
2008-07-21 21:40 ` tkoenig at gcc dot gnu dot org
2008-07-23 16:13 ` burnus at gcc dot gnu dot org
2008-07-24  8:33 ` burnus at gcc dot gnu dot org
2008-07-24  9:28 ` tkoenig at gcc dot gnu dot org
2008-07-27 10:47 ` burnus at gcc dot gnu dot org
2008-07-27 10:55 ` burnus at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).