public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45159]  New: Unneccessary temporaries
@ 2010-08-01 16:32 burnus at gcc dot gnu dot org
  2010-08-01 16:52 ` [Bug fortran/45159] " burnus at gcc dot gnu dot org
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-08-01 16:32 UTC (permalink / raw)
  To: gcc-bugs

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


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

end of thread, other threads:[~2010-09-03 16:17 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-01 16:32 [Bug fortran/45159] New: Unneccessary temporaries burnus at gcc dot gnu dot org
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

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).