summaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-20 16:46:22 +0000
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-20 16:46:22 +0000
commit941a2396e3d2af2d96a31e670b913c4331bee05b (patch)
treed0a86f6d0ca1212b434d7c1b46b1acf3cc04c3b6 /gcc/stor-layout.c
parenta3248fc4f63a569631daa30af5755c26cf0cdc93 (diff)
downloadgcc-941a2396e3d2af2d96a31e670b913c4331bee05b.tar.gz
gcc/
* expr.c (store_field): Avoid a direct store if the mode is larger than the size of the bit field. * stor-layout.c (layout_decl): If flag_strict_volatile_bitfields, treat non-volatile bit fields like volatile ones. * toplev.c (process_options): Disallow combination of -fstrict-volatile-bitfields and ABI versions less than 2. * config/arm/arm.c (arm_option_override): Don't enable flag_strict_volatile_bitfields if the ABI version is less than 2. * config/h8300/h8300.c (h8300_option_override): Likewise. * config/rx/rx.c (rx_option_override): Likewise. * config/m32c/m32c.c (m32c_option_override): Likewise. * config/sh/sh.c (sh_option_override): Likewise. gcc/testsuite/ * gcc.target/arm/volatile-bitfields-4.c: New test. * c-c++-common/abi-bf.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182545 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 359541e02df..35320c2fad9 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -622,12 +622,13 @@ 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,
occupying a complete byte or bytes on proper boundary,
- and not volatile or not -fstrict-volatile-bitfields. */
+ and not -fstrict-volatile-bitfields. If the latter is set,
+ we unfortunately can't check TREE_THIS_VOLATILE, as a cast
+ may make a volatile object later. */
if (TYPE_SIZE (type) != 0
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
&& GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT
- && !(TREE_THIS_VOLATILE (decl)
- && flag_strict_volatile_bitfields > 0))
+ && flag_strict_volatile_bitfields <= 0)
{
enum machine_mode xmode
= mode_for_size_tree (DECL_SIZE (decl), MODE_INT, 1);