diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 06a31ad3cd2..fd9123f6ae0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2013-10-21 Bernd Edlinger + + 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 * ipa-inline.c (edge_badness): Cap edge->count at max_count for badness diff --git a/gcc/expr.c b/gcc/expr.c index 76ee9e0ab7f..e672e454219 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -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); } diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 20e577d8482..4619d6e427b 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -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);