summaryrefslogtreecommitdiff
path: root/gcc/tree-sra.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r--gcc/tree-sra.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 3f84f6b22fb..2e3e97898fe 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1081,7 +1081,7 @@ disqualify_ops_if_throwing_stmt (gimple stmt, tree lhs, tree rhs)
return false;
}
-/* Scan expressions occuring in STMT, create access structures for all accesses
+/* Scan expressions occurring in STMT, create access structures for all accesses
to candidates for scalarization and remove those candidates which occur in
statements or expressions that prevent them from being split apart. Return
true if any access has been inserted. */
@@ -1549,17 +1549,20 @@ build_user_friendly_ref_for_offset (tree *res, tree type, HOST_WIDE_INT offset,
for (fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld))
{
HOST_WIDE_INT pos, size;
- tree expr, *expr_ptr;
+ tree tr_pos, expr, *expr_ptr;
if (TREE_CODE (fld) != FIELD_DECL)
continue;
- pos = int_bit_position (fld);
+ tr_pos = bit_position (fld);
+ if (!tr_pos || !host_integerp (tr_pos, 1))
+ continue;
+ pos = TREE_INT_CST_LOW (tr_pos);
gcc_assert (TREE_CODE (type) == RECORD_TYPE || pos == 0);
tr_size = DECL_SIZE (fld);
if (!tr_size || !host_integerp (tr_size, 1))
continue;
- size = tree_low_cst (tr_size, 1);
+ size = TREE_INT_CST_LOW (tr_size);
if (size == 0)
{
if (pos != offset)
@@ -2096,9 +2099,12 @@ analyze_access_subtree (struct access *root, struct access *parent,
&& (TREE_CODE (root->type) != INTEGER_TYPE
|| TYPE_PRECISION (root->type) != root->size)
/* But leave bitfield accesses alone. */
- && (root->offset % BITS_PER_UNIT) == 0)
+ && (TREE_CODE (root->expr) != COMPONENT_REF
+ || !DECL_BIT_FIELD (TREE_OPERAND (root->expr, 1))))
{
tree rt = root->type;
+ gcc_assert ((root->offset % BITS_PER_UNIT) == 0
+ && (root->size % BITS_PER_UNIT) == 0);
root->type = build_nonstandard_integer_type (root->size,
TYPE_UNSIGNED (rt));
root->expr = build_ref_for_offset (UNKNOWN_LOCATION,