diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-04-20 11:18:02 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-04-20 11:18:02 +0200 |
commit | 8a59d4660c63665613f17e2b56da6bf5a4c5c214 (patch) | |
tree | 1484e8a152e79fdd86427e4b01e206056ad5c9fa /gcc/tree.c | |
parent | a4bb5c57c9211c7eda33259af525ce5675889842 (diff) | |
download | gcc-8a59d4660c63665613f17e2b56da6bf5a4c5c214.zip gcc-8a59d4660c63665613f17e2b56da6bf5a4c5c214.tar.gz gcc-8a59d4660c63665613f17e2b56da6bf5a4c5c214.tar.bz2 |
re PR middle-end/80423 (GC related -fcompare-debug failure)
PR middle-end/80423
* tree.h (build_array_type): Add typeless_storage default argument.
* tree.c (type_cache_hasher::equal): Also compare
TYPE_TYPELESS_STORAGE flag for ARRAY_TYPEs.
(build_array_type): Add typeless_storage argument, set
TYPE_TYPELESS_STORAGE to it, if shared also hash it, and pass to
recursive call.
(build_nonshared_array_type): Adjust build_array_type_1 caller.
(build_array_type): Likewise. Add typeless_storage argument.
c-family/
* c-common.c (complete_array_type): Preserve TYPE_TYPELESS_STORAGE.
cp/
* tree.c (build_cplus_array_type): Call build_array_type
with the intended TYPE_TYPELESS_STORAGE flag value, instead
of calling build_array_type and modifying later TYPE_TYPELESS_STORAGE
on the shared type.
testsuite/
* g++.dg/other/pr80423.C: New test.
From-SVN: r247014
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -7073,7 +7073,9 @@ type_cache_hasher::equal (type_hash *a, type_hash *b) break; return 0; case ARRAY_TYPE: - return TYPE_DOMAIN (a->type) == TYPE_DOMAIN (b->type); + return (TYPE_TYPELESS_STORAGE (a->type) + == TYPE_TYPELESS_STORAGE (b->type) + && TYPE_DOMAIN (a->type) == TYPE_DOMAIN (b->type)); case RECORD_TYPE: case UNION_TYPE: @@ -8350,10 +8352,12 @@ subrange_type_for_debug_p (const_tree type, tree *lowval, tree *highval) /* Construct, lay out and return the type of arrays of elements with ELT_TYPE and number of elements specified by the range of values of INDEX_TYPE. + If TYPELESS_STORAGE is true, TYPE_TYPELESS_STORAGE flag is set on the type. If SHARED is true, reuse such a type that has already been constructed. */ static tree -build_array_type_1 (tree elt_type, tree index_type, bool shared) +build_array_type_1 (tree elt_type, tree index_type, bool typeless_storage, + bool shared) { tree t; @@ -8367,6 +8371,7 @@ build_array_type_1 (tree elt_type, tree index_type, bool shared) TREE_TYPE (t) = elt_type; TYPE_DOMAIN (t) = index_type; TYPE_ADDR_SPACE (t) = TYPE_ADDR_SPACE (elt_type); + TYPE_TYPELESS_STORAGE (t) = typeless_storage; layout_type (t); /* If the element type is incomplete at this point we get marked for @@ -8381,6 +8386,7 @@ build_array_type_1 (tree elt_type, tree index_type, bool shared) hstate.add_object (TYPE_HASH (elt_type)); if (index_type) hstate.add_object (TYPE_HASH (index_type)); + hstate.add_flag (typeless_storage); t = type_hash_canon (hstate.end (), t); } @@ -8396,7 +8402,7 @@ build_array_type_1 (tree elt_type, tree index_type, bool shared) = build_array_type_1 (TYPE_CANONICAL (elt_type), index_type ? TYPE_CANONICAL (index_type) : NULL_TREE, - shared); + typeless_storage, shared); } return t; @@ -8405,9 +8411,9 @@ build_array_type_1 (tree elt_type, tree index_type, bool shared) /* Wrapper around build_array_type_1 with SHARED set to true. */ tree -build_array_type (tree elt_type, tree index_type) +build_array_type (tree elt_type, tree index_type, bool typeless_storage) { - return build_array_type_1 (elt_type, index_type, true); + return build_array_type_1 (elt_type, index_type, typeless_storage, true); } /* Wrapper around build_array_type_1 with SHARED set to false. */ @@ -8415,7 +8421,7 @@ build_array_type (tree elt_type, tree index_type) tree build_nonshared_array_type (tree elt_type, tree index_type) { - return build_array_type_1 (elt_type, index_type, false); + return build_array_type_1 (elt_type, index_type, false, false); } /* Return a representation of ELT_TYPE[NELTS], using indices of type |