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/45159]  New: Unneccessary temporaries
Date: Sun, 01 Aug 2010 16:32:00 -0000	[thread overview]
Message-ID: <bug-45159-13404@http.gcc.gnu.org/bugzilla/> (raw)

Using today's trunk with http://gcc.gnu.org/ml/fortran/2010-08/msg00003.html
applied.

The following example were extracted from FLEUR (www.flapw.de), where
-Warray-temporaries showed that a temporary has been generated.

!-- ONE ----------------------
      subroutine t1(n1,n2, gfft, ufft)
        implicit none
        integer :: n1, n2, i
        real :: gfft(n1,n2), ufft(n2)
        DO i=1, n1
          gfft(i,:)=gfft(i,:)*ufft(i)  ! No temporary needed
        END DO
      end subroutine

!-- TWO ----------------------
   we(1:noccbd) = we(n_start:n_end)

If "1" is the (known) lower bound, no temporary is needed (if one copies from
the lower to the upper bound). Using memmove also no temporary is needed (as it
allows for this) - using memcpy this is not possible (memory needs to be
disjunct). For this case of having on the RHS only a variable, one should
probably do a middle-end assignment with ARRAY_RANGE_REF. Cf. PR 40598.


!-- THREE ----------------------

   wannint(pw1,pw2,pw3,:)=wannint(pw1,pw2,pw3,:)+wannz2(j,:)

gets a temporary generated (no pointer - and no target with argument aliasing
involved.)


-- 
           Summary: Unneccessary temporaries
           Product: gcc
           Version: 4.6.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=45159


             reply	other threads:[~2010-08-01 16:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-01 16:32 burnus at gcc dot gnu dot org [this message]
2010-08-01 16:52 ` [Bug fortran/45159] " burnus at gcc dot gnu dot org
2010-08-01 17:28 ` burnus at gcc dot gnu dot org
2010-08-01 17:37 ` tkoenig at gcc dot gnu dot org
2010-08-01 18:12 ` tkoenig at gcc dot gnu dot org
2010-08-02 11:41 ` dominiq at lps dot ens dot fr
2010-08-02 12:42 ` burnus at gcc dot gnu dot org
2010-08-02 13:39 ` dominiq at lps dot ens dot fr
2010-08-02 14:10 ` [Bug fortran/45159] Unnecessary temporaries burnus at gcc dot gnu dot org
2010-08-02 14:36 ` dominiq at lps dot ens dot fr
2010-08-02 19:00 ` tkoenig at gcc dot gnu dot org
2010-08-02 22:05 ` tkoenig at gcc dot gnu dot org
2010-08-02 22:17 ` tkoenig at gcc dot gnu dot org
2010-08-03 22:03 ` tkoenig at gcc dot gnu dot org
2010-08-06 22:34 ` tkoenig at gcc dot gnu dot org
2010-08-09 21:54 ` tkoenig at gcc dot gnu dot org
2010-08-09 22:56 ` tkoenig at gcc dot gnu dot org
2010-08-10  8:45 ` dominiq at lps dot ens dot fr
2010-08-10  9:19 ` tkoenig at netcologne dot de
2010-08-10 12:01 ` dominiq at lps dot ens dot fr
2010-08-27 12:09 ` tkoenig at gcc dot gnu dot org
2010-09-03 16:17 ` tkoenig 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-45159-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).