aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2012-03-27 10:35:55 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2012-03-27 10:35:55 +0000
commita59b038cc8edf2e34d5c9544a8805bf9b3450709 (patch)
treeafcd36162228e58e77087033fa077738a70aad88 /gcc/expr.c
parentd102ab714fbf00fbbf8b0c2e022a315b85c5e22a (diff)
downloadgcc-a59b038cc8edf2e34d5c9544a8805bf9b3450709.zip
gcc-a59b038cc8edf2e34d5c9544a8805bf9b3450709.tar.gz
gcc-a59b038cc8edf2e34d5c9544a8805bf9b3450709.tar.bz2
expmed.c (store_bit_field): Assert that BITREGION_START is a multiple of a unit before computing the offset...
* expmed.c (store_bit_field): Assert that BITREGION_START is a multiple of a unit before computing the offset in units. * expr.c (get_bit_range): Return the null range if the enclosing record is part of a larger bit field. From-SVN: r185857
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index c63343e..56ec3fa 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -4458,6 +4458,25 @@ get_bit_range (unsigned HOST_WIDE_INT *bitstart,
return;
}
+ /* If we have a DECL_BIT_FIELD_REPRESENTATIVE but the enclosing record is
+ part of a larger bit field, then the representative does not serve any
+ useful purpose. This can occur in Ada. */
+ if (handled_component_p (TREE_OPERAND (exp, 0)))
+ {
+ enum machine_mode rmode;
+ HOST_WIDE_INT rbitsize, rbitpos;
+ tree roffset;
+ int unsignedp;
+ int volatilep = 0;
+ get_inner_reference (TREE_OPERAND (exp, 0), &rbitsize, &rbitpos,
+ &roffset, &rmode, &unsignedp, &volatilep, false);
+ if ((rbitpos % BITS_PER_UNIT) != 0)
+ {
+ *bitstart = *bitend = 0;
+ return;
+ }
+ }
+
/* Compute the adjustment to bitpos from the offset of the field
relative to the representative. DECL_FIELD_OFFSET of field and
repr are the same by construction if they are not constants,