From 664e30ce643a9fa5d9b88b6058246d02047ba41b Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 23 Nov 2009 10:44:17 +0000 Subject: [PATCH] 2009-11-23 Richard Guenther * tree-dfa.c (get_ref_base_and_extent): Adjust maximum access size for DECL bases. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154433 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/tree-dfa.c | 22 ++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9a26636..a00e858 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 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 -- 2.7.4