[Bug fortran/56615] [4.6/4.7/4.8 Regression] Wrong code with TRANSFER of arrays of character with stride -1

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 14 21:05:00 GMT 2013


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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-03-14 21:04:44 UTC ---
trans-intrinsic.c gfc_conv_intrinsic_transfer's has:

      /* Repack the source if not a full variable array.  */
      if (arg->expr->expr_type == EXPR_VARIABLE
              && arg->expr->ref->u.ar.type != AR_FULL)
        {

However, I do not see any relation between being a full array and the need to
repack. A more useful check would be whether the expression is simply
contiguous or not.


--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -5436,7 +5436,6 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr *
expr)
       source_type = gfc_get_element_type (TREE_TYPE (argse.expr));

-      /* Repack the source if not a full variable array.  */
-      if (arg->expr->expr_type == EXPR_VARIABLE
-             && arg->expr->ref->u.ar.type != AR_FULL)
+      /* Repack the source if not simply contiguous.  */
+      if (!gfc_is_simply_contiguous (arg->expr, false))
        {
          tmp = gfc_build_addr_expr (NULL_TREE, argse.expr);



More information about the Gcc-bugs mailing list