public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/48997] New: Don't use allocatable arrays for function elimination
@ 2011-05-14 10:28 tkoenig at gcc dot gnu.org
  2015-05-16 12:35 ` [Bug fortran/48997] " tkoenig at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-05-14 10:28 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Don't use allocatable arrays for function elimination
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tkoenig@gcc.gnu.org
            Blocks: 36854


After revision 173752, double occurrence of functions returning arrays
within an expression are removed using an allocatable array as temporary.

It would be better to use BLOCK variables.

Example:

Transform

function optmatmul (a, b, ni, nj)  
  implicit none  
  integer, intent(in) :: ni, nj  
  double precision :: optmatmul(ni, nj)  
  double precision, intent(in) :: a(ni, nj), b(ni, nj)  
  optmatmul = matmul(a, b) / (1 + matmul(a, b))  
end function optmatmul  

(the test case from PR 22572) to

function optmatmul (a, b, c, m, n, count)
  implicit none  
  integer, intent(in) :: m, n, count
  double precision :: optmatmul(m, n)  
  double precision, intent(in) :: a(m, count), b(count, n), c(m, n)
  block
    double precision, dimension(size(a,1), size(b,2)) :: tmp
    tmp = matmul(a,b)
    optmatmul = tmp / (1 + tmp)
  end block
end function optmatmul  

We would probably need argument mapping for this.

Issues to be resolved:

- This is complicated, especially for intrinsics which take their
  return size from their arguments

- Especially ugly: pack

- Also not nice: dim=n arguments where n is a variable

- We would need a way to handle functions in argument lists specifying
  return dimensions, which we have to keep from being evaluated twice
  (not a likely corner case, but we have to be correct...)


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

* [Bug fortran/48997] Don't use allocatable arrays for function elimination
  2011-05-14 10:28 [Bug fortran/48997] New: Don't use allocatable arrays for function elimination tkoenig at gcc dot gnu.org
@ 2015-05-16 12:35 ` tkoenig at gcc dot gnu.org
  2015-10-13 13:38 ` dominiq at lps dot ens.fr
  2015-10-14 11:56 ` tkoenig at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-05-16 12:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48997
Bug 48997 depends on bug 66113, which changed state.

Bug 66113 Summary: Variable n cannot appear in the expression with nested blocks
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66113

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED


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

* [Bug fortran/48997] Don't use allocatable arrays for function elimination
  2011-05-14 10:28 [Bug fortran/48997] New: Don't use allocatable arrays for function elimination tkoenig at gcc dot gnu.org
  2015-05-16 12:35 ` [Bug fortran/48997] " tkoenig at gcc dot gnu.org
@ 2015-10-13 13:38 ` dominiq at lps dot ens.fr
  2015-10-14 11:56 ` tkoenig at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-13 13:38 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2015-10-13
     Ever confirmed|0                           |1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Thomas, what is the status of this?

PING!


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

* [Bug fortran/48997] Don't use allocatable arrays for function elimination
  2011-05-14 10:28 [Bug fortran/48997] New: Don't use allocatable arrays for function elimination tkoenig at gcc dot gnu.org
  2015-05-16 12:35 ` [Bug fortran/48997] " tkoenig at gcc dot gnu.org
  2015-10-13 13:38 ` dominiq at lps dot ens.fr
@ 2015-10-14 11:56 ` tkoenig at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-10-14 11:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Hi Dominique,

I am currently not working on this.

It is worth keeping around for partial implementation at least, if I can find
the time and/or somebody else starts working on the front end passes.


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

end of thread, other threads:[~2015-10-14 11:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-14 10:28 [Bug fortran/48997] New: Don't use allocatable arrays for function elimination tkoenig at gcc dot gnu.org
2015-05-16 12:35 ` [Bug fortran/48997] " tkoenig at gcc dot gnu.org
2015-10-13 13:38 ` dominiq at lps dot ens.fr
2015-10-14 11:56 ` 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).