diff options
| author | jye2 <jye2@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-21 02:16:12 +0000 |
|---|---|---|
| committer | jye2 <jye2@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-21 02:16:12 +0000 |
| commit | 16459f3b012163d83d6ce99b9b4e9f5b56906616 (patch) | |
| tree | 34dbbd53c18e02cc659b9d899a46473dc5ba47e8 /gcc/expr.c | |
| parent | 14fdc4a0b800960d3b71a0fb320c0c7bfe4d134a (diff) | |
| download | ppe42-gcc-16459f3b012163d83d6ce99b9b4e9f5b56906616.tar.gz ppe42-gcc-16459f3b012163d83d6ce99b9b4e9f5b56906616.zip | |
2011-11-20 Joey Ye <joey.ye@arm.com>
* expr.c (expand_expr_real_1): Correctly handle strict volatile
bitfield loads smaller than mode size.
testsuite:
* gcc.dg/volatile-bitfields-1.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181549 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
| -rw-r--r-- | gcc/expr.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/expr.c b/gcc/expr.c index 84cfe5c23ee..8d3a0f671a8 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -9740,11 +9740,16 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, && modifier != EXPAND_CONST_ADDRESS && modifier != EXPAND_INITIALIZER) /* If the field is volatile, we always want an aligned - access. Only do this if the access is not already naturally + access. Do this in following two situations: + 1. the access is not already naturally aligned, otherwise "normal" (non-bitfield) volatile fields - become non-addressable. */ + become non-addressable. + 2. the bitsize is narrower than the access size. Need + to extract bitfields from the access. */ || (volatilep && flag_strict_volatile_bitfields > 0 - && (bitpos % GET_MODE_ALIGNMENT (mode) != 0)) + && (bitpos % GET_MODE_ALIGNMENT (mode) != 0 + || (mode1 != BLKmode + && bitsize < GET_MODE_SIZE (mode1) * BITS_PER_UNIT))) /* If the field isn't aligned enough to fetch as a memref, fetch it as a bit field. */ || (mode1 != BLKmode |

