------- Comment #2 from pault at gcc dot gnu dot org  2007-03-21 15:22 -------
This fixes it

Index: gcc/fortran/trans-intrinsic.c
===================================================================
*** gcc/fortran/trans-intrinsic.c       (revision 123059)
--- gcc/fortran/trans-intrinsic.c       (working copy)
*************** gfc_conv_intrinsic_array_transfer (gfc_s
*** 2829,2834 ****
--- 2829,2835 ----
    tree extent;
    tree source;
    tree source_bytes;
+   tree mold_type;
    tree dest_word_len;
    tree size_words;
    tree size_bytes;
*************** gfc_conv_intrinsic_array_transfer (gfc_s
*** 2934,2953 ****
    if (ss == gfc_ss_terminator)
      {
        gfc_conv_expr_reference (&argse, arg->expr);
-
-       /* Obtain the source word length.  */
        tmp = gfc_size_in_bytes (&argse, arg->expr);
      }
    else
      {
        gfc_init_se (&argse, NULL);
        argse.want_pointer = 0;
        gfc_conv_expr_descriptor (&argse, arg->expr, ss);
-
-       /* Obtain the source word length.  */
        tmp = gfc_size_in_bytes (&argse, arg->expr);
      }
!
    dest_word_len = gfc_create_var (gfc_array_index_type, NULL);
    gfc_add_modify_expr (&se->pre, dest_word_len, tmp);

--- 2935,2952 ----
    if (ss == gfc_ss_terminator)
      {
        gfc_conv_expr_reference (&argse, arg->expr);
        tmp = gfc_size_in_bytes (&argse, arg->expr);
+       mold_type = TREE_TYPE (build_fold_indirect_ref (argse.expr));
      }
    else
      {
        gfc_init_se (&argse, NULL);
        argse.want_pointer = 0;
        gfc_conv_expr_descriptor (&argse, arg->expr, ss);
        tmp = gfc_size_in_bytes (&argse, arg->expr);
+       mold_type = gfc_get_element_type (TREE_TYPE (argse.expr));
      }
!
    dest_word_len = gfc_create_var (gfc_array_index_type, NULL);
    gfc_add_modify_expr (&se->pre, dest_word_len, tmp);
$
*************** gfc_conv_intrinsic_array_transfer (gfc_s
*** 3016,3025 ****
    /* Build a destination descriptor, using the pointer, source, as the
       data field.  This is already allocated so set callee_alloc.
       FIXME callee_alloc is not set!  */
-
-   tmp = gfc_typenode_for_spec (&expr->ts);
    gfc_trans_create_temp_array (&se->pre, &se->post, se->loop,
!                              info, tmp, false, true, false);

    /* Use memcpy to do the transfer.  */
    tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY],
--- 3015,3022 ----
    /* Build a destination descriptor, using the pointer, source, as the
       data field.  This is already allocated so set callee_alloc.
       FIXME callee_alloc is not set!  */
    gfc_trans_create_temp_array (&se->pre, &se->post, se->loop,
!                              info, mold_type, false, true, false);

    /* Use memcpy to do the transfer.  */
    tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY],

However, mold being string(1:1) gives the wrong result so I'll fix that first
before submitting the patch.

Paul


-- 

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-03-16 06:54:45         |2007-03-21 15:22:38
               date|                            |


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

Reply via email to