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] Implement a(:) = b(:) using memcpy when possible


On Thu, Jan 04, 2007 at 04:25:10PM -0700, Roger Sayle wrote:
> bounds are known at compile-time).  Additionally, I've discovered that
> gfortran supports "arrays of derived types containing allocatable
> components" which can't be directly copied using a block move, but require
> what the C++ front-end might call a copy constructor.  Hence the

This is the allocatable component feature that is commonly 
referred to TR 15581, ie, an addendum to the F95 standard
and part the F2003 standard.


> 2007-01-04  Roger Sayle  <roger@eyesopen.com>
> 
>         * trans-expr.c (gfc_trans_assignment_1): New subroutine to scalarize
>         array assignments split out from gfc_trans_assignment.
>         (gfc_trans_array_copy): New function to implement array to array
>         copies via calls to __builtin_memcpy.
>         (copyable_array_p): New helper function to identify an array of
>         simple/POD types, that may be copied/assigned using memcpy.
>         (gfc_trans_assignment): Use gfc_trans_array_copy to handle simple
>         whole array assignments considered suitable by copyable_array_p.
>         Invoke gfc_trans_assignment_1 to perform the fallback scalarization.
> 
>         * gfortran.dg/array_memcpy_1.f90: New test case.
>         * gfortran.dg/array_memcpy_2.f90: Likewise.


OK with two spelling corrections in comments

>   
> ! /* Try to efficiently translate dst(:) = src(:).  Return NULL if this
> !    can't be done.  EXPR1 is the destination/lhs and EXPR2 is the
> !    source/rhs, both are gfc_full_array_ref_p which have checked for

s/have/have been/

> !    dependencies.  */
>   
> ! 
> ! /* Subroutine of gfc_trans_assignment that actually scalarizes the
> !    assignment.  EXPR1 is the destination/RHS and EXPR is the source/LHS.  */

The 2nd EXPR should be EXPR2.

-- 
Steve


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