diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-27 10:35:55 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-27 10:35:55 +0000 |
commit | 73041e9b577ea9e2cb769c0ca0230ab031f08ca5 (patch) | |
tree | afcd36162228e58e77087033fa077738a70aad88 /gcc/expr.c | |
parent | 20d97f0c9cab9bb1e13004c423695bdc41bd7ae5 (diff) | |
download | gcc-73041e9b577ea9e2cb769c0ca0230ab031f08ca5.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185857 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/expr.c b/gcc/expr.c index c63343ec682..56ec3fa8e2a 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, |