From bf90208ff88549c2c200c4f60469d9ba6696c677 Mon Sep 17 00:00:00 2001 From: Julian Brown Date: Wed, 23 Mar 2011 11:57:28 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 5 +++++ gcc/expr.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fb754ab..bf04672 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-03-23 Julian Brown + + * expr.c (expand_expr_real_1): Only use BLKmode for volatile + accesses which are not naturally aligned. + 2011-03-23 Richard Sandiford PR target/47553 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 -- 2.7.4