Commit 5dfd32cd by Bernd Edlinger Committed by Bernd Edlinger

Fix DECL_BIT_FIELD depencency on flag_strict_volatile_bitfields and...

2013-10-21  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        Fix DECL_BIT_FIELD depencency on flag_strict_volatile_bitfields
        and get_inner_reference returning different pmode for non-volatile
        bit-field members dependent on flag_strict_volatile_bitfields.
        * stor-layout.c (layout_decl): Remove special handling of
        flag_strict_volatile_bitfields.
        * expr.c (get_inner_reference): Don't use DECL_BIT_FIELD
        if flag_strict_volatile_bitfields > 0 and TREE_THIS_VOLATILE.

From-SVN: r203898
parent 0bff3610
2013-10-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
Fix DECL_BIT_FIELD depencency on flag_strict_volatile_bitfields
and get_inner_reference returning different pmode for non-volatile
bit-field members dependent on flag_strict_volatile_bitfields.
* stor-layout.c (layout_decl): Remove special handling of
flag_strict_volatile_bitfields.
* expr.c (get_inner_reference): Don't use DECL_BIT_FIELD
if flag_strict_volatile_bitfields > 0 and TREE_THIS_VOLATILE.
2013-10-21 Paulo Matos <pmatos@broadcom.com> 2013-10-21 Paulo Matos <pmatos@broadcom.com>
* ipa-inline.c (edge_badness): Cap edge->count at max_count for badness * ipa-inline.c (edge_badness): Cap edge->count at max_count for badness
......
...@@ -6552,16 +6552,18 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, ...@@ -6552,16 +6552,18 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
{ {
tree field = TREE_OPERAND (exp, 1); tree field = TREE_OPERAND (exp, 1);
size_tree = DECL_SIZE (field); size_tree = DECL_SIZE (field);
if (!DECL_BIT_FIELD (field)) if (flag_strict_volatile_bitfields > 0
mode = DECL_MODE (field); && TREE_THIS_VOLATILE (exp)
else if (DECL_MODE (field) == BLKmode) && DECL_BIT_FIELD_TYPE (field)
blkmode_bitfield = true; && DECL_MODE (field) != BLKmode)
else if (TREE_THIS_VOLATILE (exp)
&& flag_strict_volatile_bitfields > 0)
/* Volatile bitfields should be accessed in the mode of the /* Volatile bitfields should be accessed in the mode of the
field's type, not the mode computed based on the bit field's type, not the mode computed based on the bit
size. */ size. */
mode = TYPE_MODE (DECL_BIT_FIELD_TYPE (field)); mode = TYPE_MODE (DECL_BIT_FIELD_TYPE (field));
else if (!DECL_BIT_FIELD (field))
mode = DECL_MODE (field);
else if (DECL_MODE (field) == BLKmode)
blkmode_bitfield = true;
*punsignedp = DECL_UNSIGNED (field); *punsignedp = DECL_UNSIGNED (field);
} }
......
...@@ -606,14 +606,10 @@ layout_decl (tree decl, unsigned int known_align) ...@@ -606,14 +606,10 @@ layout_decl (tree decl, unsigned int known_align)
/* See if we can use an ordinary integer mode for a bit-field. /* See if we can use an ordinary integer mode for a bit-field.
Conditions are: a fixed size that is correct for another mode, Conditions are: a fixed size that is correct for another mode,
occupying a complete byte or bytes on proper boundary, occupying a complete byte or bytes on proper boundary. */
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 if (TYPE_SIZE (type) != 0
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
&& GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT && GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT)
&& flag_strict_volatile_bitfields <= 0)
{ {
enum machine_mode xmode enum machine_mode xmode
= mode_for_size_tree (DECL_SIZE (decl), MODE_INT, 1); = mode_for_size_tree (DECL_SIZE (decl), MODE_INT, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment