------- Comment #8 from pault at gcc dot gnu dot org  2007-05-14 20:51 -------
The patch below works and regtests OK.  I am not convince that this is the
whole story and need to think about it for a day or two.

Paul

Index: gcc/fortran/trans-array.c
===================================================================
*** gcc/fortran/trans-array.c   (révision 124614)
--- gcc/fortran/trans-array.c   (copie de travail)
*************** gfc_conv_expr_descriptor (gfc_se * se, g
*** 4563,4569 ****
         limits will be the limits of the section.
         A function may decide to repack the array to speed up access, but
         we're not bothered about that here.  */
!       int dim, ndim;
        tree parm;
        tree parmtype;
        tree stride;
--- 4563,4569 ----
         limits will be the limits of the section.
         A function may decide to repack the array to speed up access, but
         we're not bothered about that here.  */
!       int dim, ndim, stride_ne_one;
        tree parm;
        tree parmtype;
        tree stride;
*************** gfc_conv_expr_descriptor (gfc_se * se, g
*** 4613,4623 ****
--- 4613,4628 ----
        else
        base = NULL_TREE;

+       stride_ne_one = 0;
+ 
        ndim = info->ref ? info->ref->u.ar.dimen : info->dimen;
        for (n = 0; n < ndim; n++)
        {
          stride = gfc_conv_array_stride (desc, n);

+         if (!integer_onep (info->stride[dim]))          
+           stride_ne_one = 1;
+ 
          /* Work out the offset.  */
          if (info->ref
              && info->ref->u.ar.dimen_type[n] == DIMEN_ELEMENT)
*************** gfc_conv_expr_descriptor (gfc_se * se, g
*** 4710,4715 ****
--- 4715,4725 ----
          /* Set the offset.  */
          tmp = gfc_conv_descriptor_offset (parm);
          gfc_add_modify_expr (&loop.pre, tmp, base);
+       }
+       else if (GFC_ARRAY_TYPE_P (TREE_TYPE (desc)) && !stride_ne_one)
+       {
+         tmp = gfc_conv_descriptor_offset (parm);
+         gfc_add_modify_expr (&loop.pre, tmp, gfc_conv_array_offset (desc));
        }
        else
        {


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-05-10 12:34:22         |2007-05-14 20:51:10
               date|                            |


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

Reply via email to