diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-19 10:45:26 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-19 10:45:26 +0000 |
commit | dda02ea225e9b4a0111a081c3db6c5ab476eb089 (patch) | |
tree | 5585ebe56b49c389bde1eddb7ee80e0ff227a9cf /gcc/tree-object-size.c | |
parent | bddb37639dd332492a524ea28da9aa34cf1a2903 (diff) | |
download | gcc-dda02ea225e9b4a0111a081c3db6c5ab476eb089.tar.gz |
2011-05-19 Richard Guenther <rguenther@suse.de>
PR middle-end/48985
* tree-object-size.c (addr_object_size): If the pointed-to
variable is a decl use DECL_SIZE_UNIT instead of TYPE_SIZE_UNIT.
* gcc.dg/builtin-object-size-11.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173901 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-object-size.c')
-rw-r--r-- | gcc/tree-object-size.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c index 043b445bf2e..41118d25b2e 100644 --- a/gcc/tree-object-size.c +++ b/gcc/tree-object-size.c @@ -205,6 +205,12 @@ addr_object_size (struct object_size_info *osi, const_tree ptr, pt_var_size = size_int (sz); } else if (pt_var + && DECL_P (pt_var) + && host_integerp (DECL_SIZE_UNIT (pt_var), 1) + && (unsigned HOST_WIDE_INT) + tree_low_cst (DECL_SIZE_UNIT (pt_var), 1) < offset_limit) + pt_var_size = DECL_SIZE_UNIT (pt_var); + else if (pt_var && (SSA_VAR_P (pt_var) || TREE_CODE (pt_var) == STRING_CST) && TYPE_SIZE_UNIT (TREE_TYPE (pt_var)) && host_integerp (TYPE_SIZE_UNIT (TREE_TYPE (pt_var)), 1) |