This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [FORTRAN PATCH] Consider suitable derived types copyable


Roger,

OK - thanks

Paul

Ok for mainline?



2007-01-17 Roger Sayle <roger@eyesopen.com>


        * trans-expr.c (copyable_array_p): Consider user derived type
        without allocatable components to be copyable.

* gfortran.dg/array_memcpy_4.f90: New test case.

Roger
--
------------------------------------------------------------------------


Index: trans-expr.c
===================================================================
*** trans-expr.c (revision 120834)
--- trans-expr.c (working copy)
*************** copyable_array_p (gfc_expr * expr)
*** 3815,3820 ****
--- 3815,3826 ----
case BT_LOGICAL:
return true;
+ case BT_CHARACTER:
+ return false;
+ + case BT_DERIVED:
+ return !expr->ts.derived->attr.alloc_comp;
+ default:
break;
}
------------------------------------------------------------------------


! { dg-do compile }
! { dg-options "-O2 -fdump-tree-original" }
  type t
    logical valid
    integer :: x, y
  end type
  type (t) :: s(5)
  type (t) :: d(5)

  d = s
end
! { dg-final { scan-tree-dump-times "d = " 1 "original" } }
! { dg-final { cleanup-tree-dump "original" } }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]