summaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorJie Zhang <jie@codesourcery.com>2010-10-26 03:22:49 +0000
committerJie Zhang <jiez@gcc.gnu.org>2010-10-26 03:22:49 +0000
commitf5c88dbfe7040583158ad45e4ef2801401a2732d (patch)
treee3deba847e33f104b4175dd8a3946b33f33a08d4 /gcc/stor-layout.c
parent7021d5df0a0c762b092f88d8274089fb12acc6ac (diff)
downloadgcc-f5c88dbfe7040583158ad45e4ef2801401a2732d.tar.gz
stor-layout.c (layout_decl): Use the field's type to determine the mode and keep DECL_BIT_FIELD for a...
* stor-layout.c (layout_decl): Use the field's type to determine the mode and keep DECL_BIT_FIELD for a volatile bit-field. * config/arm/arm.c (arm_override_options): Default to -fstrict-volatile-bitfields. testsuite/ * gcc.target/arm/volatile-bitfields-1.c: New test. * gcc.target/arm/volatile-bitfields-2.c: New test. * gcc.target/arm/volatile-bitfields-3.c: New test. From-SVN: r165934
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index f3663185e68..17e4fe54a37 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -661,11 +661,14 @@ layout_decl (tree decl, unsigned int known_align)
}
/* See if we can use an ordinary integer mode for a bit-field.
- Conditions are: a fixed size that is correct for another mode
- and occupying a complete byte or bytes on proper boundary. */
+ Conditions are: a fixed size that is correct for another mode,
+ occupying a complete byte or bytes on proper boundary,
+ and not volatile or not -fstrict-volatile-bitfields. */
if (TYPE_SIZE (type) != 0
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
- && GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT)
+ && GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT
+ && !(TREE_THIS_VOLATILE (decl)
+ && flag_strict_volatile_bitfields > 0))
{
enum machine_mode xmode
= mode_for_size_tree (DECL_SIZE (decl), MODE_INT, 1);