re PR fortran/30073 (Array out of bounds gives name of RHS array not LHS array)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Thu, 15 Apr 2010 21:32:21 +0000 (21:32 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Thu, 15 Apr 2010 21:32:21 +0000 (21:32 +0000)
    PR fortran/30073
    * trans-array.c (gfc_trans_array_bound_check): Eliminate a redundant
    block of code.  Set name to the variable associated with the descriptor.

From-SVN: r158392

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

index fdf4e99..b828104 100644 (file)
@@ -1,3 +1,9 @@
+2010-04-15  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/30073
+       * trans-array.c (gfc_trans_array_bound_check): Eliminate a redundant
+       block of code.  Set name to the variable associated with the descriptor.
+
 2010-04-15  Jakub Jelinek  <jakub@redhat.com>
 
        * trans-decl.c (gfc_build_qualified_array): Clear DECL_IGNORED_P
index 0380049..a880f0e 100644 (file)
@@ -2324,10 +2324,6 @@ gfc_trans_array_bound_check (gfc_se * se, tree descriptor, tree index, int n,
       && se->loop->ss->loop_chain->expr->symtree)
     name = se->loop->ss->loop_chain->expr->symtree->name;
 
-  if (!name && se->loop && se->loop->ss && se->loop->ss->loop_chain
-      && se->loop->ss->loop_chain->expr->symtree)
-    name = se->loop->ss->loop_chain->expr->symtree->name;
-
   if (!name && se->loop && se->loop->ss && se->loop->ss->expr)
     {
       if (se->loop->ss->expr->expr_type == EXPR_FUNCTION
@@ -2339,6 +2335,9 @@ gfc_trans_array_bound_check (gfc_se * se, tree descriptor, tree index, int n,
          name = "unnamed constant";
     }
 
+  if (descriptor->base.code != COMPONENT_REF)
+    name = IDENTIFIER_POINTER (DECL_NAME (descriptor));
+
   /* If upper bound is present, include both bounds in the error message.  */
   if (check_upper)
     {