public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/43173]  New: Unnecessary array temporary: Passing contiguous array as actual argument
@ 2010-02-25 11:26 burnus at gcc dot gnu dot org
  2010-02-25 12:48 ` [Bug fortran/43173] " pault at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-02-25 11:26 UTC (permalink / raw)
  To: gcc-bugs

Related to some other missed-optimization PRs, but particularly simple.

  REAL, allocatable :: ot(:)
  integer :: time_steps

  call foo (ot) ! OK, no temporary
  call foo (ot(0:5:1)) ! Unnecessary temporary
  call foo (ot(0:time_steps)) ! Unnecessary temporary
  end

Note: ot is contiguous (as it is allocatable), stride = 1, and thus all
arguments are simple contiguous - unless the stride is non-unity or one has,
e.g., "ot( [1,3,5])".

Note 2: If one has an explicit-size array, it works - there is no temporary
for:
  REAL :: ot(5)
  integer :: time_steps
  call foo (ot(1:time_steps))
I think the issue is that one mixes up the (:) of an allocatable array with the
(:) of a non-allocatable, assumed-shape dummy argument or a pointer.

The temporary seems to be generated in trans-arrays.c's
gfc_conv_array_parameter; the issue seems to be that "full_array_var" is false
and then later there is either no_pack or contiguous set to false.


-- 
           Summary: Unnecessary array temporary: Passing contiguous array as
                    actual argument
           Product: gcc
           Version: 4.5.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=43173


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

end of thread, other threads:[~2010-03-02 12:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-25 11:26 [Bug fortran/43173] New: Unnecessary array temporary: Passing contiguous array as actual argument burnus at gcc dot gnu dot org
2010-02-25 12:48 ` [Bug fortran/43173] " pault at gcc dot gnu dot org
2010-02-25 12:57 ` burnus at gcc dot gnu dot org
2010-02-26  5:28 ` pault at gcc dot gnu dot org
2010-02-26 16:06 ` pault at gcc dot gnu dot org
2010-02-27 11:36 ` [Bug fortran/43173] [4.5 Regression] " tkoenig at gcc dot gnu dot org
2010-03-01 11:54 ` [Bug fortran/43173] " rguenth at gcc dot gnu dot org
2010-03-02  9:17 ` burnus at gcc dot gnu dot org
2010-03-02  9:24 ` burnus at gcc dot gnu dot org
2010-03-02 10:02 ` burnus at gcc dot gnu dot org
2010-03-02 11:59 ` pault at gcc dot gnu dot org
2010-03-02 12:10 ` pault 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).