]> gcc.gnu.org Git - gcc.git/commitdiff
tree-dfa.c (get_ref_base_and_extent): Adjust maximum access size for DECL bases.
authorRichard Guenther <rguenther@suse.de>
Mon, 23 Nov 2009 10:44:17 +0000 (10:44 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 23 Nov 2009 10:44:17 +0000 (10:44 +0000)
2009-11-23  Richard Guenther  <rguenther@suse.de>

* tree-dfa.c (get_ref_base_and_extent): Adjust maximum access
size for DECL bases.

From-SVN: r154433

gcc/ChangeLog
gcc/tree-dfa.c

index 9a266369b932bbc1c8ee7b0b55d82b0b508b062b..a00e858faeb469d38f5baa73e49d6b98fe4ec562 100644 (file)
@@ -1,3 +1,8 @@
+2009-11-23  Richard Guenther  <rguenther@suse.de>
+
+       * tree-dfa.c (get_ref_base_and_extent): Adjust maximum access
+       size for DECL bases.
+
 2009-11-22  Richard Henderson  <rth@redhat.com>
 
        * i386.c (avx_vpermilp_parallel): New function.
index d1f84a2ebaafdea7cc060317e6d87d4e7be3c223..20bdad2cbddd004eb709c69986b93a044bd7dd0c 100644 (file)
@@ -914,13 +914,23 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
      the array.  The simplest way to conservatively deal with this
      is to punt in the case that offset + maxsize reaches the
      base type boundary.  This needs to include possible trailing padding
-     that is there for alignment purposes.  */
+     that is there for alignment purposes.
 
-  if (seen_variable_array_ref
-      && maxsize != -1
-      && (!host_integerp (TYPE_SIZE (TREE_TYPE (exp)), 1)
-         || (bit_offset + maxsize
-             == (signed) TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (exp))))))
+     That is of course only true if the base object is not a decl.  */
+
+  if (DECL_P (exp))
+    {
+      /* If maxsize is unknown adjust it according to the size of the
+         base decl.  */
+      if (maxsize == -1
+         && host_integerp (DECL_SIZE (exp), 1))
+       maxsize = TREE_INT_CST_LOW (DECL_SIZE (exp)) - bit_offset;
+    }
+  else if (seen_variable_array_ref
+          && maxsize != -1
+          && (!host_integerp (TYPE_SIZE (TREE_TYPE (exp)), 1)
+              || (bit_offset + maxsize
+                  == (signed) TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (exp))))))
     maxsize = -1;
 
   /* ???  Due to negative offsets in ARRAY_REF we can end up with
This page took 0.092866 seconds and 5 git commands to generate.