public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/55839] New: Inefficiency with array constructor
@ 2013-01-01 14:30 tkoenig at gcc dot gnu.org
  2013-01-01 19:03 ` [Bug fortran/55839] " mikael at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-01-01 14:30 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55839
           Summary: Inefficiency with array constructor
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tkoenig@gcc.gnu.org


This idiom

subroutine foo(a,b,c,n)
  integer, intent(in) :: n
  real, intent(in), dimension(n) :: a,b
  real,  intent(out), dimension(2*n) :: c
  c(1:2*n) = [a(1:n), b(1:n)]
end subroutine foo

builds an array using malloc and copies the data two times.
It would be better to express this as

   c(1:n) = a(1:n)
   c(n+1:2*n) = b(1:n)

Looks like a job for front-end optimization; it would be a bit
hard to expect the middle-end to optimize away all the calls
to malloc etc.


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

* [Bug fortran/55839] Inefficiency with array constructor
  2013-01-01 14:30 [Bug fortran/55839] New: Inefficiency with array constructor tkoenig at gcc dot gnu.org
@ 2013-01-01 19:03 ` mikael at gcc dot gnu.org
  2013-02-01 17:48 ` tkoenig at gcc dot gnu.org
  2015-05-16  6:05 ` tkoenig at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mikael at gcc dot gnu.org @ 2013-01-01 19:03 UTC (permalink / raw)
  To: gcc-bugs


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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #1 from Mikael Morin <mikael at gcc dot gnu.org> 2013-01-01 19:03:22 UTC ---
This is a known deficiency of the handling of array constructors in gfortran.
There are other bugs about them.

For cases like:
a(:) = [b(:)]

the code generated does twice as much work as needed (initialization of the
array constructor's content and copy from it).


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

* [Bug fortran/55839] Inefficiency with array constructor
  2013-01-01 14:30 [Bug fortran/55839] New: Inefficiency with array constructor tkoenig at gcc dot gnu.org
  2013-01-01 19:03 ` [Bug fortran/55839] " mikael at gcc dot gnu.org
@ 2013-02-01 17:48 ` tkoenig at gcc dot gnu.org
  2015-05-16  6:05 ` tkoenig at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-02-01 17:48 UTC (permalink / raw)
  To: gcc-bugs


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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-02-01
         AssignedTo|unassigned at gcc dot       |tkoenig at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-02-01 17:47:54 UTC ---
I'll give it a shot once trunk reopens.


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

* [Bug fortran/55839] Inefficiency with array constructor
  2013-01-01 14:30 [Bug fortran/55839] New: Inefficiency with array constructor tkoenig at gcc dot gnu.org
  2013-01-01 19:03 ` [Bug fortran/55839] " mikael at gcc dot gnu.org
  2013-02-01 17:48 ` tkoenig at gcc dot gnu.org
@ 2015-05-16  6:05 ` tkoenig at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-05-16  6:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55839

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
           Assignee|tkoenig at gcc dot gnu.org         |unassigned at gcc dot gnu.org

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
No time at the moment, working on other stuff.


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

end of thread, other threads:[~2015-05-16  6:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-01 14:30 [Bug fortran/55839] New: Inefficiency with array constructor tkoenig at gcc dot gnu.org
2013-01-01 19:03 ` [Bug fortran/55839] " mikael at gcc dot gnu.org
2013-02-01 17:48 ` tkoenig at gcc dot gnu.org
2015-05-16  6:05 ` 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).