diff options
author | Richard Biener <rguenther@suse.de> | 2016-06-28 11:55:19 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-06-28 11:55:19 +0000 |
commit | 7d4cdbd485607cc1d575a42d815a5dec7708aded (patch) | |
tree | cc5f212f823778695adf1ffc90a0354537fe9967 /gcc/tree-ssa-alias.c | |
parent | e9ac1f86bf70e0ca794fed6ba3b8fe3026da063e (diff) | |
download | gcc-7d4cdbd485607cc1d575a42d815a5dec7708aded.zip gcc-7d4cdbd485607cc1d575a42d815a5dec7708aded.tar.gz gcc-7d4cdbd485607cc1d575a42d815a5dec7708aded.tar.bz2 |
tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p): Properly handle DECL_BIT_FIELD_REPRESENTATIVE occuring as COMPONENT_REF operand.
2016-06-28 Richard Biener <rguenther@suse.de>
* tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p):
Properly handle DECL_BIT_FIELD_REPRESENTATIVE occuring as
COMPONENT_REF operand.
(nonoverlapping_component_refs_p): Likewise.
* stor-layout.c (start_bitfield_representative): Mark
DECL_BIT_FIELD_REPRESENTATIVE as DECL_NONADDRESSABLE_P.
From-SVN: r237818
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r-- | gcc/tree-ssa-alias.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index b663ddf..70c24b5 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -929,13 +929,20 @@ nonoverlapping_component_refs_of_decl_p (tree ref1, tree ref2) if (type1 != type2 || TREE_CODE (type1) != RECORD_TYPE) goto may_overlap; - /* Different fields of the same record type cannot overlap. - ??? Bitfields can overlap at RTL level so punt on them. */ if (field1 != field2) { component_refs1.release (); component_refs2.release (); - return !(DECL_BIT_FIELD (field1) && DECL_BIT_FIELD (field2)); + /* A field and its representative need to be considered the + same. */ + if (DECL_BIT_FIELD_REPRESENTATIVE (field1) == field2 + || DECL_BIT_FIELD_REPRESENTATIVE (field2) == field1) + return false; + /* Different fields of the same record type cannot overlap. + ??? Bitfields can overlap at RTL level so punt on them. */ + if (DECL_BIT_FIELD (field1) && DECL_BIT_FIELD (field2)) + return false; + return true; } } @@ -1031,9 +1038,20 @@ nonoverlapping_component_refs_p (const_tree x, const_tree y) if (typex == typey) { /* We're left with accessing different fields of a structure, - no possible overlap, unless they are both bitfields. */ + no possible overlap. */ if (fieldx != fieldy) - return !(DECL_BIT_FIELD (fieldx) && DECL_BIT_FIELD (fieldy)); + { + /* A field and its representative need to be considered the + same. */ + if (DECL_BIT_FIELD_REPRESENTATIVE (fieldx) == fieldy + || DECL_BIT_FIELD_REPRESENTATIVE (fieldy) == fieldx) + return false; + /* Different fields of the same record type cannot overlap. + ??? Bitfields can overlap at RTL level so punt on them. */ + if (DECL_BIT_FIELD (fieldx) && DECL_BIT_FIELD (fieldy)) + return false; + return true; + } } if (TYPE_UID (typex) < TYPE_UID (typey)) { |