diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9a266369b93..a00e858faeb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2009-11-23 Richard Guenther + + * tree-dfa.c (get_ref_base_and_extent): Adjust maximum access + size for DECL bases. + 2009-11-22 Richard Henderson * i386.c (avx_vpermilp_parallel): New function. diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index d1f84a2ebaa..20bdad2cbdd 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -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