diff options
author | Richard Guenther <rguenther@suse.de> | 2009-11-23 10:44:17 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-11-23 10:44:17 +0000 |
commit | 0230277c253fc21548b8f50caa1d09f70e67e4ca (patch) | |
tree | 637ba7d1df531640fbd33c390dfb5b4ddadb9987 /gcc/tree-dfa.c | |
parent | 5120dc389fd149dda37c77d84ffb743e03d285ab (diff) | |
download | gcc-0230277c253fc21548b8f50caa1d09f70e67e4ca.zip gcc-0230277c253fc21548b8f50caa1d09f70e67e4ca.tar.gz gcc-0230277c253fc21548b8f50caa1d09f70e67e4ca.tar.bz2 |
tree-dfa.c (get_ref_base_and_extent): Adjust maximum access size for DECL bases.
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
Diffstat (limited to 'gcc/tree-dfa.c')
-rw-r--r-- | gcc/tree-dfa.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index d1f84a2..20bdad2 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 |