[Bug fortran/36933] unneeded temporary with derived type containing an array as argument
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36933 Joost VandeVondele changed: What|Removed |Added Status|NEW |RESOLVED CC||Joost.VandeVondele at mat ||dot ethz.ch Resolution||FIXED --- Comment #10 from Joost VandeVondele 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.
[Bug fortran/36933] unneeded temporary with derived type containing an array as argument
--- 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
[Bug fortran/36933] unneeded temporary with derived type containing an array as argument
--- 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 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 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
[Bug fortran/36933] unneeded temporary with derived type containing an array as argument
--- 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
[Bug fortran/36933] unneeded temporary with derived type containing an array as argument
--- 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
[Bug fortran/36933] unneeded temporary with derived type containing an array as argument
--- 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
[Bug fortran/36933] unneeded temporary with derived type containing an array as argument
--- 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
[Bug fortran/36933] unneeded temporary with derived type containing an array as argument
--- 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
[Bug fortran/36933] unneeded temporary with derived type containing an array as argument
-- pinskia at gcc dot gnu dot org changed: What|Removed |Added Severity|normal |enhancement http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36933
[Bug fortran/36933] unneeded temporary with derived type containing an array as argument
--- 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
[Bug fortran/36933] unneeded temporary
--- 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|-00-00 00:00:00 |2008-07-25 13:06:45 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36933