------- Comment #3 from pinskia at gcc dot gnu dot org  2006-10-29 22:36 -------
Here is the fix which I am testing right now:
Index: trans-intrinsic.c
===================================================================
--- trans-intrinsic.c   (revision 118159)
+++ trans-intrinsic.c   (working copy)
@@ -2914,7 +2914,7 @@ gfc_conv_intrinsic_array_transfer (gfc_s


 /* Scalar transfer statement.
-   TRANSFER (source, mold) = *(typeof<mold> *)&source.  */
+   TRANSFER (source, mold) = VIEW_CONVERT_EXPR<typeof<mold> >source.  */

 static void
 gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
@@ -2939,9 +2939,9 @@ gfc_conv_intrinsic_transfer (gfc_se * se

   arg = arg->next;
   type = gfc_typenode_for_spec (&expr->ts);
-  ptr = convert (build_pointer_type (type), ptr);
   if (expr->ts.type == BT_CHARACTER)
     {
+      ptr = convert (build_pointer_type (type), ptr);
       gfc_init_se (&argse, NULL);
       gfc_conv_expr (&argse, arg->expr);
       gfc_add_block_to_block (&se->pre, &argse.pre);
@@ -2951,7 +2951,8 @@ gfc_conv_intrinsic_transfer (gfc_se * se
     }
   else
     {
-      se->expr = build_fold_indirect_ref (ptr);
+      tree tmp = build_fold_indirect_ref (ptr);
+      se->expr = fold_build1 (VIEW_CONVERT_EXPR, type, tmp);
     }
 }


-- 


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

Reply via email to