aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.6/gcc/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.6/gcc/expr.c')
-rw-r--r--gcc-4.6/gcc/expr.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc-4.6/gcc/expr.c b/gcc-4.6/gcc/expr.c
index 31f04e301..5cb5df7a2 100644
--- a/gcc-4.6/gcc/expr.c
+++ b/gcc-4.6/gcc/expr.c
@@ -9192,8 +9192,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. */
- || (volatilep && flag_strict_volatile_bitfields > 0)
+ access. Do this in following two situations:
+ 1. the access is not already naturally
+ aligned, otherwise "normal" (non-bitfield) volatile fields
+ 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
+ || (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