From f5c88dbfe7040583158ad45e4ef2801401a2732d Mon Sep 17 00:00:00 2001 From: Jie Zhang Date: Tue, 26 Oct 2010 03:22:49 +0000 Subject: 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 --- gcc/stor-layout.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gcc/stor-layout.c') diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index f366318..17e4fe5 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); -- cgit v1.1