public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/41137]  New: inefficient zeroing of an array
@ 2009-08-21  6:15 jv244 at cam dot ac dot uk
  2009-08-21  7:02 ` [Bug fortran/41137] " jv244 at cam dot ac dot uk
                   ` (13 more replies)
  0 siblings, 14 replies; 21+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-08-21  6:15 UTC (permalink / raw)
  To: gcc-bugs

triggered by some discussion in PR41113

SUBROUTINE S(a,n)
INTEGER :: n
REAL :: a(n,n,n,n)
a(:,:,:,:)=0.0
END SUBROUTINE

generates a four-fold look to do the zeroing, while it would be more efficient
to zero n**4 elements starting from a(1,1,1,1). I.e. since a is contiguous in
memory a memset or similar can be done (properly guarded for zero-sized
arrays).

Note that the case with compile time constant bounds is already captured i.e. 

.LFB2:
        movl    $40000, %edx
        xorl    %esi, %esi
        jmp     memset
.LFE2:

is generated for 

SUBROUTINE S(a)
REAL :: a(10,10,10,10)
a(:,:,:,:)=0.0
END SUBROUTINE


-- 
           Summary: inefficient zeroing of an array
           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: jv244 at cam dot ac dot uk


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41137


^ permalink raw reply	[flat|nested] 21+ messages in thread
[parent not found: <bug-41137-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2014-05-01 17:00 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-21  6:15 [Bug fortran/41137] New: inefficient zeroing of an array jv244 at cam dot ac dot uk
2009-08-21  7:02 ` [Bug fortran/41137] " jv244 at cam dot ac dot uk
2009-08-21  7:40 ` dfranke at gcc dot gnu dot org
2009-08-21  8:29 ` jv244 at cam dot ac dot uk
2009-08-24 20:06 ` jv244 at cam dot ac dot uk
2009-11-01 16:21 ` tkoenig at gcc dot gnu dot org
2009-11-01 17:36 ` tkoenig at gcc dot gnu dot org
2010-05-07 21:02 ` dfranke at gcc dot gnu dot org
2010-06-21 15:02 ` burnus at gcc dot gnu dot org
2010-06-21 15:22 ` burnus at gcc dot gnu dot org
2010-06-21 15:49 ` jv244 at cam dot ac dot uk
2010-06-21 17:00 ` burnus at gcc dot gnu dot org
2010-06-21 17:44 ` jakub at gcc dot gnu dot org
2010-06-22 14:42 ` burnus at gcc dot gnu dot org
2010-06-22 15:25 ` jakub at gcc dot gnu dot org
     [not found] <bug-41137-4@http.gcc.gnu.org/bugzilla/>
2013-03-29  9:47 ` Joost.VandeVondele at mat dot ethz.ch
2013-03-29 22:19 ` tkoenig at gcc dot gnu.org
2013-03-29 22:39 ` burnus at gcc dot gnu.org
2014-05-01 12:16 ` dominiq at lps dot ens.fr
2014-05-01 12:35 ` Joost.VandeVondele at mat dot ethz.ch
2014-05-01 17:00 ` tkoenig at gcc dot gnu.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).