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
This commit is contained in:
Bernd Edlinger 2013-10-21 15:51:48 +00:00 committed by Bernd Edlinger
parent 0bff361040
commit 5dfd32cdda
3 changed files with 20 additions and 12 deletions

View File

@ -1,3 +1,13 @@
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>
* ipa-inline.c (edge_badness): Cap edge->count at max_count for badness

View File

@ -6552,16 +6552,18 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
{
tree field = TREE_OPERAND (exp, 1);
size_tree = DECL_SIZE (field);
if (!DECL_BIT_FIELD (field))
mode = DECL_MODE (field);
else if (DECL_MODE (field) == BLKmode)
blkmode_bitfield = true;
else if (TREE_THIS_VOLATILE (exp)
&& flag_strict_volatile_bitfields > 0)
if (flag_strict_volatile_bitfields > 0
&& TREE_THIS_VOLATILE (exp)
&& DECL_BIT_FIELD_TYPE (field)
&& DECL_MODE (field) != BLKmode)
/* Volatile bitfields should be accessed in the mode of the
field's type, not the mode computed based on the bit
size. */
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);
}

View File

@ -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.
Conditions are: a fixed size that is correct for another mode,
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. */
occupying a complete byte or bytes on proper boundary. */
if (TYPE_SIZE (type) != 0
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
&& GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT
&& flag_strict_volatile_bitfields <= 0)
&& GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT)
{
enum machine_mode xmode
= mode_for_size_tree (DECL_SIZE (decl), MODE_INT, 1);