------- Comment #4 from mueller at gcc dot gnu dot org  2007-11-22 22:34 -------
thanks for the analysis. I would go for a slightly more verbose version of the
same patch: 

--- gcc/tree-vrp.c      (revision 130297)
+++ gcc/tree-vrp.c      (working copy)
@@ -4339,7 +4339,7 @@ check_array_ref (tree ref, location_t* l

   low_sub = up_sub = TREE_OPERAND (ref, 1);

-  if (!up_bound || !locus || TREE_NO_WARNING (ref)
+  if (!up_bound || TREE_NO_WARNING (ref)
       || TREE_CODE (up_bound) != INTEGER_CST
       /* Can not check flexible arrays.  */
       || (TYPE_SIZE (TREE_TYPE (ref)) == NULL_TREE
@@ -4441,6 +4441,11 @@ check_array_bounds (tree *tp, int *walk_
   tree stmt = (tree)data;
   location_t *location = EXPR_LOCUS (stmt);

+  if (!EXPR_HAS_LOCATION (stmt)) {
+      *walk_subtree = FALSE;
+      return NULL_TREE;
+  }
+
   *walk_subtree = TRUE;

   if (TREE_CODE (t) == ARRAY_REF)


-- 


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

Reply via email to