diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-30 21:39:42 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-30 21:39:42 +0000 |
commit | 20506a1d32afc8ac0bf7ed8ff183032cddd82cee (patch) | |
tree | 8fba8975eb49eb9a3a44b03ca04682c55bad8378 /gcc | |
parent | 5d4b6e9c06cae8242813f303f804f31222500c65 (diff) | |
download | ppe42-gcc-20506a1d32afc8ac0bf7ed8ff183032cddd82cee.tar.gz ppe42-gcc-20506a1d32afc8ac0bf7ed8ff183032cddd82cee.zip |
* expr.c (array_ref_element_size): Force aligned_size back to
sizetype.
(component_ref_field_offset): Similarly for aligned_offset.
* tree.c (recompute_tree_invarant_for_addr_expr): Mark raw
low-bound, element-size, field-offset fields rather than
computed values.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86803 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/expr.c | 20 | ||||
-rw-r--r-- | gcc/tree.c | 11 |
3 files changed, 33 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 00f5745e38a..00e61c6c32a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-08-30 Richard Henderson <rth@redhat.com> + + * expr.c (array_ref_element_size): Force aligned_size back to + sizetype. + (component_ref_field_offset): Similarly for aligned_offset. + * tree.c (recompute_tree_invarant_for_addr_expr): Mark raw + low-bound, element-size, field-offset fields rather than + computed values. + 2004-08-30 Joseph S. Myers <jsm@polyomino.org.uk> * c-parse.in (parmlist_or_identifiers_1): Remove unreachable and diff --git a/gcc/expr.c b/gcc/expr.c index d3c3e89799c..ca19b7a62c1 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -5481,8 +5481,14 @@ array_ref_element_size (tree exp) /* If a size was specified in the ARRAY_REF, it's the size measured in alignment units of the element type. So multiply by that value. */ if (aligned_size) - return size_binop (MULT_EXPR, aligned_size, - size_int (TYPE_ALIGN (elmt_type) / BITS_PER_UNIT)); + { + /* ??? tree_ssa_useless_type_conversion will eliminate casts to + sizetype from another type of the same width and signedness. */ + if (TREE_TYPE (aligned_size) != sizetype) + aligned_size = fold_convert (sizetype, aligned_size); + return size_binop (MULT_EXPR, aligned_size, + size_int (TYPE_ALIGN (elmt_type) / BITS_PER_UNIT)); + } /* Otherwise, take the size from that of the element type. Substitute any PLACEHOLDER_EXPR that we have. */ @@ -5541,8 +5547,14 @@ component_ref_field_offset (tree exp) in units of DECL_OFFSET_ALIGN / BITS_PER_UNIT. So multiply by that value. */ if (aligned_offset) - return size_binop (MULT_EXPR, aligned_offset, - size_int (DECL_OFFSET_ALIGN (field) / BITS_PER_UNIT)); + { + /* ??? tree_ssa_useless_type_conversion will eliminate casts to + sizetype from another type of the same width and signedness. */ + if (TREE_TYPE (aligned_offset) != sizetype) + aligned_offset = fold_convert (sizetype, aligned_offset); + return size_binop (MULT_EXPR, aligned_offset, + size_int (DECL_OFFSET_ALIGN (field) / BITS_PER_UNIT)); + } /* Otherwise, take the offset from that of the field. Substitute any PLACEHOLDER_EXPR that we have. */ diff --git a/gcc/tree.c b/gcc/tree.c index 1c5060e5869..90e77ab2735 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -2252,15 +2252,20 @@ do { tree _node = (NODE); \ && TREE_CODE (TREE_TYPE (TREE_OPERAND (node, 0))) == ARRAY_TYPE) { UPDATE_TITCSE (TREE_OPERAND (node, 1)); - UPDATE_TITCSE (array_ref_low_bound (node)); - UPDATE_TITCSE (array_ref_element_size (node)); + if (TREE_OPERAND (node, 2)) + UPDATE_TITCSE (TREE_OPERAND (node, 2)); + if (TREE_OPERAND (node, 3)) + UPDATE_TITCSE (TREE_OPERAND (node, 3)); } /* Likewise, just because this is a COMPONENT_REF doesn't mean we have a FIELD_DECL, apparently. The G++ front end can put something else there, at least temporarily. */ else if (TREE_CODE (node) == COMPONENT_REF && TREE_CODE (TREE_OPERAND (node, 1)) == FIELD_DECL) - UPDATE_TITCSE (component_ref_field_offset (node)); + { + if (TREE_OPERAND (node, 2)) + UPDATE_TITCSE (TREE_OPERAND (node, 2)); + } else if (TREE_CODE (node) == BIT_FIELD_REF) UPDATE_TITCSE (TREE_OPERAND (node, 2)); } |