re PR fortran/49074 ([OOP] Defined assignment w/ CLASS arrays: Incomplete error message)
authorMikael Morin <mikael@gcc.gnu.org>
Thu, 13 Jun 2013 14:26:47 +0000 (14:26 +0000)
committerMikael Morin <mikael@gcc.gnu.org>
Thu, 13 Jun 2013 14:26:47 +0000 (14:26 +0000)
fortran/
PR fortran/49074
* trans-expr.c (gfc_conv_variable): Don't walk the reference chain.
Handle NULL array references.
(gfc_conv_procedure_call): Remove code handling NULL array references.

testsuite/
PR fortran/49074
* gfortran.dg/typebound_assignment_5.f03: New.

From-SVN: r200069

gcc/fortran/ChangeLog
gcc/fortran/trans-expr.c
gcc/testsuite/ChangeLog

index 6b37acd..cd491a0 100644 (file)
@@ -1,3 +1,10 @@
+2013-06-13  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/49074
+       * trans-expr.c (gfc_conv_variable): Don't walk the reference chain.
+       Handle NULL array references.
+       (gfc_conv_procedure_call): Remove code handling NULL array references.
+
 2013-06-11  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/57535
index 9d07345..bd8886c 100644 (file)
@@ -1761,9 +1761,12 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr)
       /* A scalarized term.  We already know the descriptor.  */
       se->expr = ss_info->data.array.descriptor;
       se->string_length = ss_info->string_length;
-      for (ref = ss_info->data.array.ref; ref; ref = ref->next)
-       if (ref->type == REF_ARRAY && ref->u.ar.type != AR_ELEMENT)
-         break;
+      ref = ss_info->data.array.ref;
+      if (ref)
+       gcc_assert (ref->type == REF_ARRAY
+                   && ref->u.ar.type != AR_ELEMENT);
+      else
+       gfc_conv_tmp_array_ref (se);
     }
   else
     {
@@ -4041,23 +4044,11 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
          gfc_init_se (&parmse, se);
          parm_kind = ELEMENTAL;
 
-         if (ss->dimen > 0 && e->expr_type == EXPR_VARIABLE
-             && ss->info->data.array.ref == NULL)
-           {
-             gfc_conv_tmp_array_ref (&parmse);
-             if (e->ts.type == BT_CHARACTER)
-               gfc_conv_string_parameter (&parmse);
-             else
-               parmse.expr = gfc_build_addr_expr (NULL_TREE, parmse.expr);
-           }
-         else
-           {
-             gfc_conv_expr_reference (&parmse, e);
-             if (e->ts.type == BT_CHARACTER && !e->rank
-                 && e->expr_type == EXPR_FUNCTION)
-               parmse.expr = build_fold_indirect_ref_loc (input_location,
-                                                          parmse.expr);
-           }
+         gfc_conv_expr_reference (&parmse, e);
+         if (e->ts.type == BT_CHARACTER && !e->rank
+             && e->expr_type == EXPR_FUNCTION)
+           parmse.expr = build_fold_indirect_ref_loc (input_location,
+                                                      parmse.expr);
 
          if (fsym && fsym->ts.type == BT_DERIVED
              && gfc_is_class_container_ref (e))
index e3dd654..912fe61 100644 (file)
@@ -1,3 +1,8 @@
+2013-06-13  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/49074
+       * gfortran.dg/typebound_assignment_5.f03: New.
+
 2013-06-13  Marc Glisse  <marc.glisse@inria.fr>
 
        * gcc.dg/tree-ssa/forwprop-27.c: New testcase.