public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36933]  New: unneeded temporary
@ 2008-07-25 11:01 jv244 at cam dot ac dot uk
  2008-07-25 13:07 ` [Bug fortran/36933] " tkoenig at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: jv244 at cam dot ac dot uk @ 2008-07-25 11:01 UTC (permalink / raw)
  To: gcc-bugs

another unneeded temporary (since a has neither a pointer nor a target
attribute)

MODULE M1
  IMPLICIT NONE
  TYPE cell_type
     REAL :: h(3,3)
  END TYPE
CONTAINS
  SUBROUTINE S1(cell)
     TYPE(cell_type), POINTER :: cell
     REAL :: a(3),b(3)
     a=MATMUL(cell%h,b)
  END SUBROUTINE S1
END MODULE M1


-- 
           Summary: unneeded temporary
           Product: gcc
           Version: 4.4.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=36933


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

* [Bug fortran/36933] unneeded temporary
  2008-07-25 11:01 [Bug fortran/36933] New: unneeded temporary jv244 at cam dot ac dot uk
@ 2008-07-25 13:07 ` tkoenig at gcc dot gnu dot org
  2008-07-28 10:39 ` [Bug fortran/36933] unneeded temporary with derived type containing an array as argument tkoenig at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-07-25 13:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tkoenig at gcc dot gnu dot org  2008-07-25 13:06 -------
Confirmed.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkoenig at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-07-25 13:06:45
               date|                            |


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


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

* [Bug fortran/36933] unneeded temporary with derived type containing an array as argument
  2008-07-25 11:01 [Bug fortran/36933] New: unneeded temporary jv244 at cam dot ac dot uk
  2008-07-25 13:07 ` [Bug fortran/36933] " tkoenig at gcc dot gnu dot org
@ 2008-07-28 10:39 ` tkoenig at gcc dot gnu dot org
  2008-08-17  0:07 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-07-28 10:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tkoenig at gcc dot gnu dot org  2008-07-28 10:38 -------
No temporary is done if the first argument of the
matmul intrinsic is a (3,3) array.

Interesting.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|unneeded temporary          |unneeded temporary with
                   |                            |derived type containing an
                   |                            |array as argument


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


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

* [Bug fortran/36933] unneeded temporary with derived type containing an array as argument
  2008-07-25 11:01 [Bug fortran/36933] New: unneeded temporary jv244 at cam dot ac dot uk
  2008-07-25 13:07 ` [Bug fortran/36933] " tkoenig at gcc dot gnu dot org
  2008-07-28 10:39 ` [Bug fortran/36933] unneeded temporary with derived type containing an array as argument tkoenig at gcc dot gnu dot org
@ 2008-08-17  0:07 ` pinskia at gcc dot gnu dot org
  2008-11-14  8:36 ` jv244 at cam dot ac dot uk
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-08-17  0:07 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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


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

* [Bug fortran/36933] unneeded temporary with derived type containing an array as argument
  2008-07-25 11:01 [Bug fortran/36933] New: unneeded temporary jv244 at cam dot ac dot uk
                   ` (2 preceding siblings ...)
  2008-08-17  0:07 ` pinskia at gcc dot gnu dot org
@ 2008-11-14  8:36 ` jv244 at cam dot ac dot uk
  2009-08-19  6:38 ` jv244 at cam dot ac dot uk
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: jv244 at cam dot ac dot uk @ 2008-11-14  8:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jv244 at cam dot ac dot uk  2008-11-14 08:34 -------
This could be somewhat similar, I really wonder if this needs a temp:

TYPE T1
 INTEGER :: a(3)
END TYPE T1
TYPE(T1), POINTER :: x,y
ALLOCATE(x,y)
x%a=y%a
END


-- 


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


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

* [Bug fortran/36933] unneeded temporary with derived type containing an array as argument
  2008-07-25 11:01 [Bug fortran/36933] New: unneeded temporary jv244 at cam dot ac dot uk
                   ` (3 preceding siblings ...)
  2008-11-14  8:36 ` jv244 at cam dot ac dot uk
@ 2009-08-19  6:38 ` jv244 at cam dot ac dot uk
  2010-02-10  9:04 ` jv244 at cam dot ac dot uk
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-08-19  6:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jv244 at cam dot ac dot uk  2009-08-19 06:38 -------
I believe this is has an origin that could be related to PR41113


-- 


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


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

* [Bug fortran/36933] unneeded temporary with derived type containing an array as argument
  2008-07-25 11:01 [Bug fortran/36933] New: unneeded temporary jv244 at cam dot ac dot uk
                   ` (4 preceding siblings ...)
  2009-08-19  6:38 ` jv244 at cam dot ac dot uk
@ 2010-02-10  9:04 ` jv244 at cam dot ac dot uk
  2010-02-10  9:30 ` jv244 at cam dot ac dot uk
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: jv244 at cam dot ac dot uk @ 2010-02-10  9:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jv244 at cam dot ac dot uk  2010-02-10 09:03 -------
(In reply to comment #4)
> I believe this is has an origin that could be related to PR41113
this is not fixed by the patch in PR41113, the testcase in comment #3 might
actually be tricky. 


-- 


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


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

* [Bug fortran/36933] unneeded temporary with derived type containing an array as argument
  2008-07-25 11:01 [Bug fortran/36933] New: unneeded temporary jv244 at cam dot ac dot uk
                   ` (5 preceding siblings ...)
  2010-02-10  9:04 ` jv244 at cam dot ac dot uk
@ 2010-02-10  9:30 ` jv244 at cam dot ac dot uk
  2010-02-19 21:21 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: jv244 at cam dot ac dot uk @ 2010-02-10  9:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jv244 at cam dot ac dot uk  2010-02-10 09:29 -------
(In reply to comment #5)
> the testcase in comment #3 might
> actually be tricky. 

Let me clarify:

TYPE T1
 INTEGER :: a(3)
END TYPE T1
TYPE(T1), POINTER :: x,y
x=>y
x%a=y%a
END

in this case x%a and y%a are the same array in memory, which might make this a
somewhat special case? Obviously, they are known to be contiguous 


-- 


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


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

* [Bug fortran/36933] unneeded temporary with derived type containing an array as argument
  2008-07-25 11:01 [Bug fortran/36933] New: unneeded temporary jv244 at cam dot ac dot uk
                   ` (6 preceding siblings ...)
  2010-02-10  9:30 ` jv244 at cam dot ac dot uk
@ 2010-02-19 21:21 ` burnus at gcc dot gnu dot org
  2010-02-20 12:48 ` pault at gcc dot gnu dot org
  2010-02-21 14:11 ` jv244 at cam dot ac dot uk
  9 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-02-19 21:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from burnus at gcc dot gnu dot org  2010-02-19 21:20 -------
(In reply to comment #3)
> This could be somewhat similar, I really wonder if this needs a temp:
> 
> TYPE T1
>  INTEGER :: a(3)
> END TYPE T1
> TYPE(T1), POINTER :: x,y
> ALLOCATE(x,y)
> x%a=y%a
> END

I think one needs a temporary, cf. the following code:

integer, pointer :: a(:),b(:)
allocate(a(3))
a = [1,2,3]
b => a(3:1:-1)
a = b
print *, a
end


-- 


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


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

* [Bug fortran/36933] unneeded temporary with derived type containing an array as argument
  2008-07-25 11:01 [Bug fortran/36933] New: unneeded temporary jv244 at cam dot ac dot uk
                   ` (7 preceding siblings ...)
  2010-02-19 21:21 ` burnus at gcc dot gnu dot org
@ 2010-02-20 12:48 ` pault at gcc dot gnu dot org
  2010-02-21 14:11 ` jv244 at cam dot ac dot uk
  9 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-02-20 12:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pault at gcc dot gnu dot org  2010-02-20 12:47 -------
Subject: Bug 36933

Author: pault
Date: Sat Feb 20 12:46:43 2010
New Revision: 156926

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156926
Log:
2010-02-20  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/36932
        PR fortran/36933
        PR fortran/43072
        PR fortran/43111
        * dependency.c (gfc_check_argument_var_dependency): Use enum
        value instead of arithmetic vaue for 'elemental'.
        (check_data_pointer_types): New function.
        (gfc_check_dependency): Call check_data_pointer_types.
        * trans-array.h : Change fourth argument of
        gfc_conv_array_parameter to boolean.
        * trans-array.c (gfc_conv_array_parameter): A contiguous array
        can be a dummy but it must not be assumed shape or deferred.
        Change fourth argument to boolean. Array constructor exprs will
        always be contiguous and do not need packing and unpacking.
        * trans-expr.c (gfc_conv_procedure_call): Clean up some white
        space and change fourth argument of gfc_conv_array_parameter
        to boolean.
        (gfc_trans_arrayfunc_assign): Change fourth argument of
        gfc_conv_array_parameter to boolean.
        * trans-io.c (gfc_convert_array_to_string): The same.
        * trans-intrinsic.c (gfc_conv_intrinsic_loc): The same.

2010-02-20  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/36932
        PR fortran/36933
        * gfortran.dg/dependency_26.f90: New test.

        PR fortran/43072
        * gfortran.dg/internal_pack_7.f90: New test.

        PR fortran/43111
        * gfortran.dg/internal_pack_8.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/dependency_26.f90
    trunk/gcc/testsuite/gfortran.dg/internal_pack_7.f90
    trunk/gcc/testsuite/gfortran.dg/internal_pack_8.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/dependency.c
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/fortran/trans-array.h
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/fortran/trans-intrinsic.c
    trunk/gcc/fortran/trans-io.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/36933] unneeded temporary with derived type containing an array as argument
  2008-07-25 11:01 [Bug fortran/36933] New: unneeded temporary jv244 at cam dot ac dot uk
                   ` (8 preceding siblings ...)
  2010-02-20 12:48 ` pault at gcc dot gnu dot org
@ 2010-02-21 14:11 ` jv244 at cam dot ac dot uk
  9 siblings, 0 replies; 12+ messages in thread
From: jv244 at cam dot ac dot uk @ 2010-02-21 14:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jv244 at cam dot ac dot uk  2010-02-21 14:11 -------
(In reply to comment #7)
> (In reply to comment #3)
> > This could be somewhat similar, I really wonder if this needs a temp:
> > 
> > TYPE T1
> >  INTEGER :: a(3)
> > END TYPE T1
> > TYPE(T1), POINTER :: x,y
> > ALLOCATE(x,y)
> > x%a=y%a
> > END
> 
> I think one needs a temporary, cf. the following code:
> 
> integer, pointer :: a(:),b(:)
> allocate(a(3))
> a = [1,2,3]
> b => a(3:1:-1)
> a = b
> print *, a
> end
> 
this is example is different, here a temp can not be avoided. It is different
in that a and b have the pointer attribute, while x%a and x%b do not have the
pointer attribute (only the parent structure). But still, the example in
comment #3 seems tricky enough to defer optimization if you as me.


-- 


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


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

* [Bug fortran/36933] unneeded temporary with derived type containing an array as argument
       [not found] <bug-36933-4@http.gcc.gnu.org/bugzilla/>
@ 2013-03-29 10:20 ` Joost.VandeVondele at mat dot ethz.ch
  0 siblings, 0 replies; 12+ messages in thread
From: Joost.VandeVondele at mat dot ethz.ch @ 2013-03-29 10:20 UTC (permalink / raw)
  To: gcc-bugs


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

Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |Joost.VandeVondele at mat
                   |                            |dot ethz.ch
         Resolution|                            |FIXED

--- Comment #10 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> 2013-03-29 10:20:31 UTC ---
The original problem is fixed. The problem in comment #3 seems not worth
fixing, and would require alias analysis in the FE.


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

end of thread, other threads:[~2013-03-29 10:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-25 11:01 [Bug fortran/36933] New: unneeded temporary jv244 at cam dot ac dot uk
2008-07-25 13:07 ` [Bug fortran/36933] " tkoenig at gcc dot gnu dot org
2008-07-28 10:39 ` [Bug fortran/36933] unneeded temporary with derived type containing an array as argument tkoenig at gcc dot gnu dot org
2008-08-17  0:07 ` pinskia at gcc dot gnu dot org
2008-11-14  8:36 ` jv244 at cam dot ac dot uk
2009-08-19  6:38 ` jv244 at cam dot ac dot uk
2010-02-10  9:04 ` jv244 at cam dot ac dot uk
2010-02-10  9:30 ` jv244 at cam dot ac dot uk
2010-02-19 21:21 ` burnus at gcc dot gnu dot org
2010-02-20 12:48 ` pault at gcc dot gnu dot org
2010-02-21 14:11 ` jv244 at cam dot ac dot uk
     [not found] <bug-36933-4@http.gcc.gnu.org/bugzilla/>
2013-03-29 10:20 ` Joost.VandeVondele at mat dot ethz.ch

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