aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2013-11-29 12:09:12 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2013-11-29 12:09:12 +0000
commitb8815bd32f6029b77dc97143edc6d39aa5e014df (patch)
treeea78b02f66385bff3c767df1f4fda696cf51412e /gcc/tree-cfg.c
parentb54fc5b7ee19a2410460a2424a4fb8754a7467cb (diff)
downloadgcc-b8815bd32f6029b77dc97143edc6d39aa5e014df.zip
gcc-b8815bd32f6029b77dc97143edc6d39aa5e014df.tar.gz
gcc-b8815bd32f6029b77dc97143edc6d39aa5e014df.tar.bz2
re PR middle-end/59338 (error: position plus size exceeds size of referenced object in BIT_FIELD_REF)
2013-11-29 Richard Biener <rguenther@suse.de> PR middle-end/59338 * tree-cfg.c (verify_expr): Restrict bounds verification of BIT_FIELD_REF arguments to non-aggregate typed base objects. * gcc.dg/torture/pr59338.c: New testcase. From-SVN: r205521
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r--gcc/tree-cfg.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index f8937c6..605990e 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2715,17 +2715,6 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
tree t0 = TREE_OPERAND (t, 0);
tree t1 = TREE_OPERAND (t, 1);
tree t2 = TREE_OPERAND (t, 2);
- tree t0_type = TREE_TYPE (t0);
- unsigned HOST_WIDE_INT t0_size = 0;
-
- if (tree_fits_uhwi_p (TYPE_SIZE (t0_type)))
- t0_size = tree_to_uhwi (TYPE_SIZE (t0_type));
- else
- {
- HOST_WIDE_INT t0_max_size = max_int_size_in_bytes (t0_type);
- if (t0_max_size > 0)
- t0_size = t0_max_size * BITS_PER_UNIT;
- }
if (!tree_fits_uhwi_p (t1)
|| !tree_fits_uhwi_p (t2))
{
@@ -2749,8 +2738,9 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
"match field size of BIT_FIELD_REF");
return t;
}
- if (t0_size != 0
- && tree_to_uhwi (t1) + tree_to_uhwi (t2) > t0_size)
+ if (!AGGREGATE_TYPE_P (TREE_TYPE (t0))
+ && (tree_to_uhwi (t1) + tree_to_uhwi (t2)
+ > tree_to_uhwi (TYPE_SIZE (TREE_TYPE (t0)))))
{
error ("position plus size exceeds size of referenced object in "
"BIT_FIELD_REF");