This patch backports the upstream fix in r171347 for a problem caused by change in volatile bitfield access. This is tested by building the x86 toolchain with tests and checking that volatile bitfield access worked on ARM. This is a backport for 4.6 only.
2011-11-16 Doug Kwan <dougk...@google.com> Backport r171347 from trunk. 2011-03-23 Julian Brown <jul...@codesourcery.com> * expr.c (expand_expr_real_1): Only use BLKmode for volatile accesses which are not naturally aligned. Index: gcc/expr.c =================================================================== --- gcc/expr.c (revision 181400) +++ gcc/expr.c (working copy) @@ -9200,8 +9200,11 @@ && 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 -- This patch is available for review at http://codereview.appspot.com/5396043