From: edlinger Date: Mon, 21 Oct 2013 15:51:48 +0000 (+0000) Subject: 2013-10-21 Bernd Edlinger X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7691c4ce070775bb88aabcb56dcaf4d356451ebb;p=thirdparty%2Fgcc.git 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203898 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 06a31ad3cd26..fd9123f6ae0c 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 76ee9e0ab7f0..e672e454219b 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 20e577d84826..4619d6e427b3 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);