aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorJulian Brown <julian@codesourcery.com>2011-03-23 11:57:28 +0000
committerJulian Brown <jules@gcc.gnu.org>2011-03-23 11:57:28 +0000
commitbf90208ff88549c2c200c4f60469d9ba6696c677 (patch)
tree03c32c91566610e208ad992f71e36a4c1f6fd28e /gcc/expr.c
parent3505a737fd92d93b1602ed6daa1ef702b0504462 (diff)
downloadgcc-bf90208ff88549c2c200c4f60469d9ba6696c677.zip
gcc-bf90208ff88549c2c200c4f60469d9ba6696c677.tar.gz
gcc-bf90208ff88549c2c200c4f60469d9ba6696c677.tar.bz2
expr.c (expand_expr_real_1): Only use BLKmode for volatile accesses which are not naturally aligned.
* expr.c (expand_expr_real_1): Only use BLKmode for volatile accesses which are not naturally aligned. From-SVN: r171347
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 572f0f4..4db1c77 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -9147,8 +9147,11 @@ 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. Only do this if the access is not already naturally
+ aligned, otherwise "normal" (non-bitfield) volatile fields
+ become non-addressable. */
+ || (volatilep && flag_strict_volatile_bitfields > 0
+ && (bitpos % GET_MODE_ALIGNMENT (mode) != 0))
/* If the field isn't aligned enough to fetch as a memref,
fetch it as a bit field. */
|| (mode1 != BLKmode