public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/29952]  New: Flag to give runtime information " array temporary was created for argument"
Date: Thu, 23 Nov 2006 09:49:00 -0000	[thread overview]
Message-ID: <bug-29952-13404@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2006-11-23  9:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-23  9:49 burnus at gcc dot gnu dot org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29952-13404@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).