OSDN Git Service

* trans-array.h (struct gfc_se): New flag want_coarray.
authormikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Oct 2011 19:24:07 +0000 (19:24 +0000)
committermikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Oct 2011 19:24:07 +0000 (19:24 +0000)
* trans-intrinsic.c (trans_this_image, trans_image_index,
conv_intrinsic_cobound): Set want_coarray.
* trans_array.c (gfc_conv_expr_descriptor): Evaluate codimension
earlier and without relying on the scalarizer.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179676 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-array.c
gcc/fortran/trans-intrinsic.c
gcc/fortran/trans.h

index 4263f19..9428b51 100644 (file)
@@ -1,5 +1,13 @@
 2011-10-07  Mikael Morin  <mikael.morin@sfr.fr>
 
+       * trans-array.h (struct gfc_se): New flag want_coarray.
+       * trans-intrinsic.c (trans_this_image, trans_image_index,
+       conv_intrinsic_cobound): Set want_coarray.
+       * trans_array.c (gfc_conv_expr_descriptor): Evaluate codimension
+       earlier and without relying on the scalarizer.
+
+2011-10-07  Mikael Morin  <mikael.morin@sfr.fr>
+
        * expr.c (gfc_get_corank): Return 0 if input expression is not a
        coarray.
 
index 88849ef..88998de 100644 (file)
@@ -5988,6 +5988,11 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
       tree to;
       tree base;
 
+      if (se->want_coarray)
+       codim = gfc_get_corank (expr);
+      else
+       codim = 0;
+
       /* Set the string_length for a character array.  */
       if (expr->ts.type == BT_CHARACTER)
        se->string_length =  gfc_get_expr_charlen (expr);
@@ -6036,7 +6041,6 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
        base = NULL_TREE;
 
       ndim = info->ref ? info->ref->u.ar.dimen : info->dimen;
-      codim = info->codimen;
       for (n = 0; n < ndim; n++)
        {
          stride = gfc_conv_array_stride (desc, n);
index de5a809..c216873 100644 (file)
@@ -974,6 +974,7 @@ trans_this_image (gfc_se * se, gfc_expr *expr)
   ss = gfc_walk_expr (expr->value.function.actual->expr);
   gcc_assert (ss != gfc_ss_terminator);
   ss->data.info.codimen = corank;
+  argse.want_coarray = 1;
   gfc_conv_expr_descriptor (&argse, expr->value.function.actual->expr, ss);
   gfc_add_block_to_block (&se->pre, &argse.pre);
   gfc_add_block_to_block (&se->post, &argse.post);
@@ -1161,6 +1162,7 @@ trans_image_index (gfc_se * se, gfc_expr *expr)
   ss = gfc_walk_expr (expr->value.function.actual->expr);
   gcc_assert (ss != gfc_ss_terminator);
   ss->data.info.codimen = corank;
+  argse.want_coarray = 1;
   gfc_conv_expr_descriptor (&argse, expr->value.function.actual->expr, ss);
   gfc_add_block_to_block (&se->pre, &argse.pre);
   gfc_add_block_to_block (&se->post, &argse.post);
@@ -1488,6 +1490,7 @@ conv_intrinsic_cobound (gfc_se * se, gfc_expr * expr)
   gcc_assert (ss != gfc_ss_terminator);
   ss->data.info.codimen = corank;
   gfc_init_se (&argse, NULL);
+  argse.want_coarray = 1;
 
   gfc_conv_expr_descriptor (&argse, arg->expr, ss);
   gfc_add_block_to_block (&se->pre, &argse.pre);
index 0c249a6..6157a88 100644 (file)
@@ -86,6 +86,8 @@ typedef struct gfc_se
      args alias.  */
   unsigned force_tmp:1;
 
+  unsigned want_coarray:1;
+
   /* Scalarization parameters.  */
   struct gfc_se *parent;
   struct gfc_ss *ss;